Jump to content

How to make a Script to recover Destroyed vehicles?


Recommended Posts

  • 3 months later...

Hi

 

If "Destroyed" = "Exploded" then use onVehicleExplode event and insert vehicle data into a table or database, so you can create or spawn it with the same data (color, position, id, name itc)

 

If "Destroyed" = destroyElement (vehicle) then use onElementDestroy event the same way

Link to comment

Server side

addEventHandler ("onVehicleExplode", root, function()
	local x, y, z = getElementPosition(source)
	local rx, ry, rz = getElementRotation(source)
	
	setVehicleRespawnPosition (source, x, y, z, rx, ry, rz)
	
	setTimer(function(veh)
		respawnVehicle (veh) 
	end, 1000, 1, source)
end)

 

  • Like 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...