OnPlayerSpawn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
No edit summary
Line 1: Line 1:
[[Category:Incomplete Event]]
__NOTOC__  
__NOTOC__  
This event is blahblah and is used for blahblah.
This event is called when a player spawns.


==Syntax==  
==Syntax==  
Line 9: Line 7:
</syntaxhighlight>  
</syntaxhighlight>  


==Example==  
==Variables==
This example does...
*'''spawnpoint''':  A spawnpoint element representing the spawnpoint at which the player was spawned.
<syntaxhighlight lang="lua">
*'''team''': A team element representing the team of the spawnpoint.
--This line does...
 
blabhalbalhb --abababa
==Example==
--This line does this...
This example plays a sound when a player spawns
mooo
<syntaxhighlight lang="lua">addEventHandler ( "onPlayerSpawn", getElementRoot(), "onPlayerSpawn" ) --add an event for onPlayerSpawn
</syntaxhighlight>
function onPlayerSpawn ( spawnpoint, team ) --when a player spawns
  playSound ( source, 16 ) --play a sound for him
end</syntaxhighlight>

Revision as of 23:47, 17 November 2006

This event is called when a player spawns.

Syntax

void onPlayerSpawn ( spawnpoint spawnpoint, team )      

Variables

  • 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