RespawnVehicle: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 16: Line 16:
==Example==  
==Example==  
<!-- Explain what the example is in a single sentance -->
<!-- Explain what the example is in a single sentance -->
This example does...
This example makes an exploded vehicle re-spawn after 5 seconds!
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<!-- Add the code below, an emphasis should be on making it clear, not optimized. You could provide two versions if you wish, one clear and well commented, the other optimized -->
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
function respawnExplodedVehicle()
blabhalbalhb --abababa
setTimer(respawnVehicle, 5000, 1, source)
--This line does this...
end
addEventHandler("onVehicleExplode", getRootElement(), respawnExplodedVehicle)
mooo
mooo
</syntaxhighlight>
</syntaxhighlight>

Revision as of 12:39, 7 February 2008

This function respawns a vehicle according to its set respawn position, set by setVehicleRespawnPosition. To spawn to a specific location, spawnVehicle can be used..

Syntax

bool respawnVehicle ( vehicle theVehicle )

Required Arguments

  • theVehicle: The vehicle you wish to respawn

Returns

Returns true if the vehicle respawned successfully, false if the passed argument does not exist or is not a vehicle.

Example

This example makes an exploded vehicle re-spawn after 5 seconds!

function respawnExplodedVehicle()
	setTimer(respawnVehicle, 5000, 1, source)
end
addEventHandler("onVehicleExplode", getRootElement(), respawnExplodedVehicle)
mooo

See Also