OnPlayerSpawn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 8: Line 8:


==Variables==
==Variables==
* The source of this event refers to the player who spawned.
*'''spawnpoint''':  A spawnpoint element representing the spawnpoint at which the player was spawned.
*'''spawnpoint''':  A spawnpoint element representing the spawnpoint at which the player was spawned.
*'''team''': A team element representing the team of the spawnpoint.
*'''team''': A team element representing the team of the spawnpoint.

Revision as of 15:28, 2 December 2006

This event is called when a player spawns.

Syntax

void onPlayerSpawn ( spawnpoint spawnpoint, team )      

Variables

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

Example

This example plays a sound when a player spawns

addEventHandler ( "onPlayerSpawn", getElementRoot(), "onPlayerSpawn" ) --add an event for onPlayerSpawn
function onPlayerSpawn ( spawnpoint, team ) --when a player spawns
  playSound ( source, 16 ) --play a sound for him
end