Today i do present my script about stopping vehicle to dispawn and saving to the place where you left them. even after a reboot.
features:
vehicle spawns where you the last time you left it
if vehicle desspawn , because no player nearby, it does spawn the vehicle again , to not loose your car
if you car does explode, it deletes automaticly, puts back into your garage and you will have fine of x $
This script goes with ESX. (tried to make standalone script but wouldn’t work…). It does work, tested on main server, just it has some lacks of fps going down to some players, each check game freezes like 0.1 ms, likely noticeble when playing and aperently not the correct method to check the vehicles.
So up to you to use it or not, if someone is really good in networking i appreciate to correct me and push some changes on github
Can you explan us where we use the snipped? I try it but i have the same Problem like the user thefull… the cars respawn again after parking in Garage.
can someone turn me on the right way though repairing it.
Tell me how you repaired esx_jb_stopvehicledespawn , what kind of garage you use please help me im use esx_drp_garage , I have such a problem when I get out of the car I get 5 others with local boards
local playerPed = GetPlayerPed(-1)
if IsPedInAnyVehicle(playerPed, false) then
local vehicle = GetVehiclePedIsIn(playerPed,false)
local vehicleProps = ESX.Game.GetVehicleProperties(vehicle)
local networkid = NetworkGetNetworkIdFromEntity(vehicle)
local GotTrailer, TrailerHandle = GetVehicleTrailerVehicle(vehicle)
local trailerProps = ESX.Game.GetVehicleProperties(TrailerHandle)
if GotTrailer then
ESX.TriggerServerCallback('eden_garage:stockv',function(valid)
if(valid) then
local trailerplate = GetVehicleNumberPlateText(TrailerHandle)
for k,v in pairs (carInstance) do
if v.plate == trailerplate then
table.remove(carInstance, k)
end
end
DeleteVehicle(TrailerHandle)
TriggerServerEvent('eden_garage:modifystate', trailerProps, true, KindOfVehicle)
TriggerEvent('esx:showNotification', '~g~Veículo guardado na garagem')
else
TriggerEvent('esx:showNotification', '~r~Você não pode guardar este veículo')
end
end,trailerProps, KindOfVehicle)
hasAlreadyEnteredMarker = false
else
ESX.TriggerServerCallback('eden_garage:stockv',function(valid)
if(valid) then
local vehicleplate = GetVehicleNumberPlateText(vehicle)
for k,v in pairs (carInstance) do
if v.plate == vehicleplate then
table.remove(carInstance, k)
end
end
DeleteVehicle(vehicle)
TriggerServerEvent('esx_jb_stopvehicledespawn:vehicleenteredingarage', networkid)
TriggerServerEvent('eden_garage:modifystate', vehicleProps, true, KindOfVehicle)
TriggerEvent('esx:showNotification', '~g~Veículo guardado na garagem')
else
TriggerEvent('esx:showNotification', '~r~Você não pode guardar este veículo')
end
end,vehicleProps, KindOfVehicle)
end
else
TriggerEvent('esx:showNotification', 'Você tem que estar no veículo para guardarlo')
end
CurrentAction = 'garage_delete'
end
vehicle shop ? you don"t need anything because looks for cars you enter, then checkes lisence plates. but it is true that new plates are not recorded yet. we have to make an event if you buy a car to automaticly add then to plate table server sided