Entity::destroy: Difference between revisions
MrPancakers (talk | contribs) mNo edit summary |
MrPancakers (talk | contribs) m (Fixed up page) |
||
| Line 1: | Line 1: | ||
This function used | This function is used to destroy a created entity. | ||
==Syntax== | ==Syntax== | ||
| Line 9: | Line 9: | ||
This example create vehicle, and destroy after few seconds. | This example create vehicle, and destroy after few seconds. | ||
<div class="header" style="background-color: #00baad; color: #FFFFFF; border: 2px solid #00baad;"> | <div class="header" style="background-color: #00baad; color: #FFFFFF; border: 2px solid #00baad;"> | ||
<div style="margin: 10px 10px 10px 10px;"><b>Shared</b> | <div style="margin: 10px 10px 10px 10px;"><b>Shared</b></div> | ||
</div> | |||
<pre> | <pre> | ||
mp.events.addCommand( | mp.events.addCommand('veh', (player) => { | ||
let vehicle = mp.vehicles.new(mp.joaat(`zentorno`), player.position); //Create a Vehicle | let vehicle = mp.vehicles.new(mp.joaat(`zentorno`), player.position); //Create a Vehicle | ||
setTimeout(()=>{ //Create a Timer | setTimeout(()=>{ //Create a Timer | ||
| Line 22: | Line 20: | ||
}); | }); | ||
</pre> | </pre> | ||
</div> | |||
Revision as of 01:43, 29 September 2018
This function is used to destroy a created entity.
Syntax
entity.destroy();
Example
This example create vehicle, and destroy after few seconds.
Shared
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);
});