OnPlayerSpawn

From Multi Theft Auto: Wiki
Revision as of 19:25, 22 April 2007 by Jbeta (talk | contribs)
Jump to navigation Jump to search

This event is called when a player spawns.

Syntax

void onPlayerSpawn ( spawnpoint theSpawnpoint, team theTeam )

Parameters

  • The source of this event refers to the player who spawned.
  • theSpawnpoint: a spawnpoint element representing the spawnpoint at which the player was spawned.
  • theTeam: a team element representing the team of the spawnpoint.

Example

This example plays a sound when a player spawns.

-- add the player_Spawn function as a handler for onPlayerSpawn
addEventHandler ( "onPlayerSpawn", getRootElement(), "player_Spawn" )
-- when a player spawns,
function player_Spawn ( inSpawnpoint, inTeam )
	-- play a frontend sound for him
	playSoundFrontEnd ( source, 16 )
end

See also