Fix VehicleProperties function and remove credits

This commit is contained in:
Arctos2win
2024-01-27 15:27:42 +01:00
committed by GitHub
parent 4eab57589f
commit cfd62c7a31
+2 -18
View File
@@ -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)