EntityDeleted
This event is triggered when an Entity Is Deleted. From my testing, this event is only accessible on the serverside.
Server-Side Event
C# | JavaScript |
---|
JavaScript Syntax
Parameters
- entity: Entity - the entity that was deleted
Example
function entityDeletedHandler(entity) { console.log(`Entity with handle id ${entity.id} has beenb deleted`); } mp.events.add("entityDeleted", entityDeletedHandler);
C# Syntax
Parameters
- entity: Entity - the entity that was deleted
Example
The example below logs in server console when an entity is created, showing the entity model, position and remoteId.
[ServerEvent(Event.EntityDeleted)]
public void OnEntityDeleted(GTANetworkAPI.Entity entity)
{
NAPI.Util.ConsoleOutput($"Entity with handle id {entity.Handle} has been deleted");
}