From 9a1a58671b6cabdca61e78638d7ee84dd6e3b1b1 Mon Sep 17 00:00:00 2001 From: Dan Date: Fri, 26 Feb 2021 15:47:41 +0000 Subject: [PATCH] fix: still syncing when there's no other player --- cl_sync.lua | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/cl_sync.lua b/cl_sync.lua index 295b6b0..4bd1bf1 100644 --- a/cl_sync.lua +++ b/cl_sync.lua @@ -35,9 +35,11 @@ SYNC = {} function SYNC:SendPowerState( state ) local otherPed = PLY:GetOtherPed() - local otherPly = GetPlayerServerId( NetworkGetPlayerIndexFromPed( otherPed ) ) + if ( otherPed ~= nil and otherPed ~= 0 ) then + local otherPly = GetPlayerServerId( NetworkGetPlayerIndexFromPed( otherPed ) ) - TriggerServerEvent( "wk_wars2x_sync:sendPowerState", otherPly, state ) + TriggerServerEvent( "wk_wars2x_sync:sendPowerState", otherPly, state ) + end end