From Multi Theft Auto: Wiki
Jump to navigation Jump to search

This event is triggered when any player, including a remote player, spawns.


team hisTeam
  • hisTeam: A team element representing the team the player spawned on.


The source of this event is the player that spawned.


This code will create an explosion for the local player when they spawn.

function explosionOnSpawn ( )
  -- get the spawned player's position
  local pX, pY, pZ = getElementPosition ( source )
  -- and create an explosion there
  createExplosion ( pX, pY, pZ, 6 )
-- add this function as a handler for any player that spawns
addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), explosionOnSpawn )

See Also

Client player events

Client event functions