Entity::destroy: Difference between revisions
m (category) |
No edit summary |
||
| Line 1: | Line 1: | ||
__TOC__ | |||
{{SharedFunctionJS}} | |||
This function is used to destroy a created entity. | This function is used to destroy a created entity. | ||
{{JSContainer| | |||
==Syntax== | ==Syntax== | ||
< | <pre> | ||
entity.destroy(); | entity.destroy(); | ||
</ | </pre> | ||
==Example== | ==Example== | ||
This example create vehicle, and destroy after few seconds. | This example create vehicle, and destroy after few seconds. | ||
<pre> | <pre> | ||
mp.events.addCommand('veh', (player) => { | mp.events.addCommand('veh', (player) => { | ||
| Line 20: | Line 24: | ||
}); | }); | ||
</pre> | </pre> | ||
}} | |||
[[Category:Entity API]] | [[Category:Entity API]] | ||
[[Category:Shared Function]] | [[Category:Shared Function]] | ||
Revision as of 12:24, 2 December 2019
This function is used to destroy a created entity.
JavaScript Syntax
Syntax
entity.destroy();
Example
This example create vehicle, and destroy after few seconds.
mp.events.addCommand('veh', (player) => {
let vehicle = mp.vehicles.new(mp.joaat(`zentorno`), player.position); //Create a Vehicle
setTimeout(()=>{ //Create a Timer
if(vehicle){
vehicle.destroy(); //Destroy the Vehicle
}
},5000);
});