Wiki
Clone wikiEFLC-MP LUA / onPlayerSpawnEntity
Description
This event is triggered when the player spawns a server entity.
Parameters
Int playerId, Bool spawned, Int entityType, Int entityId
Bool spawned: true if spawned, false if despawned
Int entityType: 0 player, 1 vehicle, 2 checkpoint, 3 object and 4 NPC
Int entityId: id of the entity
Return values
Example
#!lua function onEntitySpawn(playerid, spawned, entityType, entityId) if(entityType == 0) then entityType = "Player" if spawned then setPlayerDraw(playerid, entityId, true, true) --Creates a blip for the player if auto_blip_tags is disabled end elseif(entityType == 1) then entityType = "Vehicle" elseif(entityType == 4) then entityType = "NPC" end if(spawned) then spawned = "spawned" else spawned = "despawned" end sendPlayerMsg(playerid, string.format("%s (%d) %s", entityType, entityId, spawned), 0xFFFF0000) end registerEvent("onEntitySpawn", "onPlayerSpawnEntity")
Updated