Entity::destroy

From RAGE Multiplayer Wiki
Revision as of 01:43, 29 September 2018 by MrPancakers (talk | contribs) (Fixed up page)

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);
});