Skip to content

Commit cf02676

Browse files
authored
Add files via upload
1 parent c8b33d8 commit cf02676

File tree

1 file changed

+14
-4
lines changed

1 file changed

+14
-4
lines changed

client.lua

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -203,18 +203,28 @@ RegisterNetEvent('pv:applyExtra', function(netId, extra)
203203
end)
204204

205205
local function ensureNetId(veh)
206+
if veh == 0 or not DoesEntityExist(veh) then return 0 end
207+
206208
local netId = VehToNet(veh)
207209
if netId ~= 0 then return netId end
208210

209-
NetworkRegisterEntityAsNetworked(veh)
210-
211211
local tries = 0
212212
::continue::
213+
214+
if not DoesEntityExist(veh) then return 0 end
215+
216+
if not NetworkHasControlOfEntity(veh) then
217+
NetworkRequestControlOfEntity(veh)
218+
end
219+
220+
NetworkRegisterEntityAsNetworked(veh)
221+
213222
netId = VehToNet(veh)
214223
if netId ~= 0 then return netId end
224+
215225
tries += 1
216-
if tries >= 25 then return 0 end
217-
Wait(0)
226+
if tries >= 50 then return 0 end
227+
Wait(25)
218228
goto continue
219229
end
220230

0 commit comments

Comments
 (0)