Merge pull request #1296 from Arctos2win/Arctos2win-VehicleProperties

Fix VehicleProperties function and remove credits
This commit is contained in:
Gellipapa
2024-01-27 19:09:47 +01:00
committed by GitHub
+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)