OnPlayerSpawn: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 15: | Line 15: | ||
This example plays a sound when a player spawns. | This example plays a sound when a player spawns. | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
-- when a player spawns, | -- when a player spawns, | ||
function player_Spawn ( inSpawnpoint, inTeam ) | function player_Spawn ( inSpawnpoint, inTeam ) | ||
Line 22: | Line 20: | ||
playSoundFrontEnd ( source, 16 ) | playSoundFrontEnd ( source, 16 ) | ||
end | end | ||
-- add the player_Spawn function as a handler for onPlayerSpawn | |||
addEventHandler ( "onPlayerSpawn", getRootElement(), player_Spawn ) | |||
</syntaxhighlight> | </syntaxhighlight> | ||
==See also== | ==See also== | ||
{{Event functions}} | {{Event functions}} |
Revision as of 21:59, 6 July 2007
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.
-- 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
- addEvent
- addEventHandler
- cancelEvent
- cancelLatentEvent
- getEventHandlers
- getLatentEventHandles
- getLatentEventStatus
- removeEventHandler
- triggerEvent
- wasEventCancelled