mirror of
https://github.com/Michatec/wk_wars2x.git
synced 2026-04-01 08:26:27 +02:00
refactor: making sync functions are streamlined a bit
This commit is contained in:
@@ -36,16 +36,21 @@ SYNC = {}
|
|||||||
--[[----------------------------------------------------------------------------------
|
--[[----------------------------------------------------------------------------------
|
||||||
Sync functions
|
Sync functions
|
||||||
----------------------------------------------------------------------------------]]--
|
----------------------------------------------------------------------------------]]--
|
||||||
function SYNC:SendPowerState( state )
|
function SYNC:SyncData( cb )
|
||||||
local otherPed = PLY:GetOtherPed()
|
local otherPed = PLY:GetOtherPed()
|
||||||
|
|
||||||
if ( otherPed ~= nil and otherPed ~= 0 ) then
|
if ( otherPed ~= nil and otherPed ~= 0 ) then
|
||||||
local otherPly = GetPlayerServerId( NetworkGetPlayerIndexFromPed( otherPed ) )
|
local otherPly = GetPlayerServerId( NetworkGetPlayerIndexFromPed( otherPed ) )
|
||||||
|
|
||||||
TriggerServerEvent( "wk_wars2x_sync:sendPowerState", otherPly, state )
|
cb( otherPly )
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function SYNC:SendPowerState( state )
|
||||||
|
self:SyncData( function( ply )
|
||||||
|
TriggerServerEvent( "wk_wars2x_sync:sendPowerState", ply, state )
|
||||||
|
end )
|
||||||
|
end
|
||||||
|
|
||||||
--[[----------------------------------------------------------------------------------
|
--[[----------------------------------------------------------------------------------
|
||||||
Sync client events
|
Sync client events
|
||||||
|
|||||||
Reference in New Issue
Block a user