DeleteEntity

From GT-MP
Jump to: navigation, search
DeleteEntity
Shared Function
Utilities-terminal.png Server-Side System-users.png Client-Side
Csharp.png C# Javascript.png JavaScript

Deletes a entity for complete.

Syntax

API.deleteEntity(NetHandle entity);

Required Arguments

  • entity: parameter input should be in NetHandle type.

Usage example(s)

The command below destroys a vehicle of a player using the DeleteEntity function.

In C#
Server-Side Function

[Command("destroymyvehicle")]
public void DestroyVehicle(Client playerid)
{
    // Check if player is in any vehicle.
    if(!API.isPlayerInAnyVehicle(playerid))
    {
        API.sendChatMessageToPlayer(playerid, "You are not in a vehicle.");
        return; // Command will stop right here, will not continue, because the player isn't in a vehicle.
    }
    // Continue if player is in a vehicle.
    API.sendChatMessageToPlayer(playerid, "You destroyed your vehicle!");
    API.deleteEntity(API.getPlayerVehicle(playerid));
}

Changelog

Version Description
1.0 Release.

References