mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 04:01:22 +00:00
Fix VehicleProperties function and remove credits
This commit is contained in:
@@ -260,32 +260,16 @@ AddEventHandler("esx:restoreLoadout", function()
|
||||
end
|
||||
end)
|
||||
|
||||
-- Credit: https://github.com/LukeWasTakenn, https://github.com/LukeWasTakenn/luke_garages/blob/master/client/client.lua#L331-L352
|
||||
AddStateBagChangeHandler("VehicleProperties", nil, function(bagName, _, value)
|
||||
if not value then
|
||||
return
|
||||
end
|
||||
|
||||
local netId = bagName:gsub("entity:", "")
|
||||
local timer = GetGameTimer()
|
||||
while not NetworkDoesEntityExistWithNetworkId(tonumber(netId)) do
|
||||
Wait(0)
|
||||
if GetGameTimer() - timer > 10000 then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
local vehicle = NetToVeh(tonumber(netId))
|
||||
local timer2 = GetGameTimer()
|
||||
while NetworkGetEntityOwner(vehicle) ~= PlayerId() do
|
||||
Wait(0)
|
||||
if GetGameTimer() - timer2 > 10000 then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
ESX.Game.SetVehicleProperties(vehicle, value)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterNetEvent("esx:setAccountMoney")
|
||||
AddEventHandler("esx:setAccountMoney", function(account)
|
||||
|
||||
Reference in New Issue
Block a user