mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 00:16:27 +02:00
style: remove trailing spaces
This commit is contained in:
38
cl_sync.lua
38
cl_sync.lua
@@ -2,10 +2,10 @@
|
||||
|
||||
Wraith ARS 2X
|
||||
Created by WolfKnight
|
||||
|
||||
For discussions, information on future updates, and more, join
|
||||
my Discord: https://discord.gg/fD4e6WD
|
||||
|
||||
|
||||
For discussions, information on future updates, and more, join
|
||||
my Discord: https://discord.gg/fD4e6WD
|
||||
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2020-2021 WolfKnight
|
||||
@@ -34,35 +34,35 @@ SYNC = {}
|
||||
|
||||
|
||||
--[[----------------------------------------------------------------------------------
|
||||
Sync functions
|
||||
Sync functions
|
||||
----------------------------------------------------------------------------------]]--
|
||||
function SYNC:SyncData( cb )
|
||||
local otherPed = PLY:GetOtherPed()
|
||||
|
||||
if ( otherPed ~= nil and otherPed ~= 0 ) then
|
||||
if ( otherPed ~= nil and otherPed ~= 0 ) then
|
||||
local otherPly = GetPlayerServerId( NetworkGetPlayerIndexFromPed( otherPed ) )
|
||||
|
||||
cb( otherPly )
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
function SYNC:SendPowerState( state )
|
||||
self:SyncData( function( ply )
|
||||
TriggerServerEvent( "wk_wars2x_sync:sendPowerState", ply, state )
|
||||
end )
|
||||
end
|
||||
end
|
||||
|
||||
function SYNC:SendAntennaPowerState( state, ant )
|
||||
self:SyncData( function( ply )
|
||||
TriggerServerEvent( "wk_wars2x_sync:sendAntennaPowerState", ply, state, ant )
|
||||
end )
|
||||
end
|
||||
end
|
||||
|
||||
function SYNC:SendAntennaMode( ant, mode )
|
||||
self:SyncData( function( ply )
|
||||
TriggerServerEvent( "wk_wars2x_sync:sendAntennaMode", ply, ant, mode )
|
||||
end )
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
--[[----------------------------------------------------------------------------------
|
||||
@@ -72,35 +72,35 @@ RegisterNetEvent( "wk_wars2x_sync:receivePowerState" )
|
||||
AddEventHandler( "wk_wars2x_sync:receivePowerState", function( state )
|
||||
local power = RADAR:IsPowerOn()
|
||||
|
||||
if ( power ~= state ) then
|
||||
if ( power ~= state ) then
|
||||
Citizen.SetTimeout( 100, function()
|
||||
RADAR:TogglePower()
|
||||
end )
|
||||
end
|
||||
end
|
||||
end )
|
||||
|
||||
RegisterNetEvent( "wk_wars2x_sync:receiveAntennaPowerState" )
|
||||
AddEventHandler( "wk_wars2x_sync:receiveAntennaPowerState", function( state, antenna )
|
||||
local power = RADAR:IsAntennaTransmitting( antenna )
|
||||
|
||||
if ( power ~= state ) then
|
||||
if ( power ~= state ) then
|
||||
RADAR:ToggleAntenna( antenna, function()
|
||||
-- Update the interface with the new antenna transmit state
|
||||
SendNUIMessage( { _type = "antennaXmit", ant = antenna, on = state } )
|
||||
|
||||
|
||||
-- Play some audio specific to the transmit state
|
||||
SendNUIMessage( { _type = "audio", name = state and "xmit_on" or "xmit_off", vol = RADAR:GetSettingValue( "beep" ) } )
|
||||
end )
|
||||
end
|
||||
end
|
||||
end )
|
||||
|
||||
RegisterNetEvent( "wk_wars2x_sync:receiveAntennaMode" )
|
||||
AddEventHandler( "wk_wars2x_sync:receiveAntennaMode", function( antenna, mode )
|
||||
RADAR:SetAntennaMode( antenna, mode, function()
|
||||
-- Update the interface with the new mode
|
||||
-- Update the interface with the new mode
|
||||
SendNUIMessage( { _type = "antennaMode", ant = antenna, mode = mode } )
|
||||
|
||||
-- Play a beep
|
||||
|
||||
-- Play a beep
|
||||
SendNUIMessage( { _type = "audio", name = "beep", vol = RADAR:GetSettingValue( "beep" ) } )
|
||||
end )
|
||||
end )
|
||||
Reference in New Issue
Block a user