Entity::destroy

From RAGE Multiplayer Wiki
Revision as of 13:39, 16 January 2018 by Toxsi (talk | contribs) (→‎Example)

This function used for destroy created entitity.

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);
    setTimeout(()=>{
        if(vehicle){
            vehicle.destroy();
        }
    },5000);
});