Vehicle::explode: Difference between revisions

From RAGE Multiplayer Wiki
No edit summary
(Updated example and page)
Line 1: Line 1:
Explodes a selected vehicle.<br>
__NOTOC__
==Syntax==
{{SharedJsFunction}}
<syntaxhighlight lang="javascript">vehicle.explode();</syntaxhighlight>
Explodes the target vehicle.
=== Required Arguments ===
{{JSContainer|
===Return value===
== Syntax ==
*'''Undefined'''
 
==Example==
<pre>
<syntaxhighlight lang="javascript">
var vehicle = mp.vehicles.new(989294410, player.position); //Spawns Voltic2 at 'player' position
vehicle.explode();
vehicle.explode();
</syntaxhighlight>
</pre>
==See also==
 
{{Vehicle_function_c}}
== Examples ==
[[Category:Clientside API]]
Creates a bomb command which sets the car you're sitting in to explode in 10 seconds.
[[Category:TODO: Example]]
{{ServersideCode|
<pre>
mp.events.addCommand('bomb', (player) => {
if(player.vehicle){
let veh_id = player.vehicle.id;
player.outputChatBox('Bomb activated, vehicle will blow in 10 seconds.')
setTimeout(() => {
mp.vehicles.at(veh_id).explode();
}, 10000);
}
});
</pre>
}}
}}
== See Also ==
{{Vehicle_function}}
[[Category:Shared API]]
[[Category:Shared Function]]
[[Category:Vehicle API]]

Revision as of 02:23, 27 April 2020

Shared
Function

 JavaScript


Explodes the target vehicle.

JavaScript Syntax

Syntax

vehicle.explode();

Examples

Creates a bomb command which sets the car you're sitting in to explode in 10 seconds.

Server-Side
mp.events.addCommand('bomb', (player) => {
	if(player.vehicle){
		let veh_id = player.vehicle.id;
		player.outputChatBox('Bomb activated, vehicle will blow in 10 seconds.')
		setTimeout(() => {
			mp.vehicles.at(veh_id).explode();
		}, 10000);
	}
});


See Also