OnPlayerSpawn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
Line 4: Line 4:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
void onPlayerSpawn ( spawnpoint theSpawnpoint, team theTeam )
void onPlayerSpawn ( float x, float y, float z, float rotation, team theTeam, int model, int interior, int dimension )
</syntaxhighlight>  
</syntaxhighlight>


==Parameters==
==Parameters==

Revision as of 00:29, 15 October 2007

This event is called when a player spawns.

Syntax

void onPlayerSpawn ( float x, float y, float z, float rotation, team theTeam, int model, int interior, int dimension )

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.

-- when a player spawns,
function player_Spawn ( inSpawnpoint, inTeam )
	-- 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

Shared