onPlayerSpawn | Multi Theft Auto: Wiki Skip to content

onPlayerSpawn

Client-side
Server-side
Shared

This event is called when a player spawns.

Parameters

float posX, float posY, float posZ, float spawnRotation, team theTeam, int theSkin, int theInterior, int theDimension
  • posX: the X position the player spawned at.
  • posY: the Y position the player spawned at.
  • posZ: the Z position the player spawned at.
  • spawnRotation: the rotation the player spawned with.
  • theTeam: the team the player spawned with.
  • theSkin: the skin/model the player spawned with.
  • theInterior: the interior the player spawned in.
  • theDimension: the dimension the player spawned in.

Source

element: The source of this event is the player that just spawned.

Code Examples

server

This example plays a sound when a player spawns.

-- when a player spawns,
function player_Spawn ( posX, posY, posZ, spawnRotation, theTeam, theSkin, theInterior, theDimension )
-- play a frontend sound for him
playSoundFrontEnd ( source, 16 )
end
-- add the player_Spawn function as a handler for onPlayerSpawn
addEventHandler ( "onPlayerSpawn", getRootElement(), player_Spawn )

See Also