Vehicle::explode: Difference between revisions

From RAGE Multiplayer Wiki
(Updated example and page)
 
Line 27: Line 27:
== See Also ==
== See Also ==
{{Vehicle_function}}
{{Vehicle_function}}
{{Vehicle_definition_c}}
[[Category:Shared API]]
[[Category:Shared API]]
[[Category:Shared Function]]
[[Category:Shared Function]]
[[Category:Vehicle API]]
[[Category:Vehicle API]]

Latest revision as of 11:31, 9 May 2024

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