Skip to content

Commit

Permalink
Merge pull request #1296 from Arctos2win/Arctos2win-VehicleProperties
Browse files Browse the repository at this point in the history
Fix VehicleProperties function and remove credits
  • Loading branch information
Gellipapa authored Jan 27, 2024
2 parents ecfe35c + cfd62c7 commit e223119
Showing 1 changed file with 2 additions and 18 deletions.
20 changes: 2 additions & 18 deletions [core]/es_extended/client/main.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit e223119

Please sign in to comment.