[SEMI-RELEASE] esx_jb_stopvehicledespawn

Hello!

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 :slight_smile:

link:
esx_jb_stopvehicledespawn

19 Likes

cool


1 Like

Such a good work! :slight_smile:
But the onliest thing is that eden_garage we dont know where to do the snippet for the garage script^^

function ranger(vehicle,vehicleProps)
ESX.Game.DeleteVehicle(vehicle)
networkid = NetworkGetNetworkIdFromEntity(vehicle)
TriggerServerEvent(‘vehicleenteredingarage’, networkid)
TriggerServerEvent(‘eden_garage:modifystate’, vehicleProps, true)
TriggerEvent(‘esx:showNotification’, _U(‘vehicle_in_garage’))
end

and it already spawning the parked cars :smiley: But instead some of the best releases!

1 Like

thanks you are the best

for esx_drp_garage ? :slight_smile:

1 Like

it is for esx_eden_garage its an old ressource but we like that^^

1 Like

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.

thanks

Running into an issue where players will just be sitting in vehicle and another one will show up on top of them. Keeps duping every so often.

like i said up to you to use it or not. it does work on my sevrer but did remove it. because of the issues i mentioned

Solved some problems and working great in my server. Nice release.

thats great to hear ! don’t hesitate to push the modifications :slight_smile:

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

Maybe you can help me with my Question? =)

Add me on Discord.
SrTinogar#3501

Thanks a lot! it works for me. Nice fix ^^

	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

Jager_Bom could you tell me how to put the code you passed in the vehicle shop

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

has to add a time for the car to stay on the server

why if you do not have a time to vanish vehicle, recovery of vehicles paid in the garage is without utility