OnClientPlayerSpawn: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
 
(Undo revision 36279 by MOJRM-511 (talk))
 
(3 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Incomplete Event]]
{{Client event}}
 
__NOTOC__  
__NOTOC__  
This event is blahblah and is used for blahblah.
This event is triggered when any player, including a remote player, spawns.


==Syntax==  
==Parameters==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
void onClientPlayerSpawn ( team hisTeam )
team hisTeam
</syntaxhighlight>  
</syntaxhighlight>  
*'''hisTeam''': A team element representing the team the player spawned on.
==Source==
The [[event system#Event source|source]] of this event is the [[player]] that spawned.


==Example==  
==Example==  
This example does...
This code will create an explosion for the local player when they spawn.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">function explosionOnSpawn ( )
--This line does...
  -- get the spawned player's position
blabhalbalhb --abababa
  local pX, pY, pZ = getElementPosition ( source )
--This line does this...
  -- and create an explosion there
mooo
  createExplosion ( pX, pY, pZ, 6 )
end
-- add this function as a handler for any player that spawns
addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), explosionOnSpawn )
</syntaxhighlight>
</syntaxhighlight>
==See Also==
===Client player events===
{{Client_player_events}}
===Client event functions===
{{Client_event_functions}}

Latest revision as of 23:59, 1 June 2013

This event is triggered when any player, including a remote player, spawns.

Parameters

team hisTeam
  • hisTeam: A team element representing the team the player spawned on.

Source

The source of this event is the player that spawned.

Example

This code will create an explosion for the local player when they spawn.

function explosionOnSpawn ( )
  -- get the spawned player's position
  local pX, pY, pZ = getElementPosition ( source )
  -- and create an explosion there
  createExplosion ( pX, pY, pZ, 6 )
end
-- add this function as a handler for any player that spawns
addEventHandler ( "onClientPlayerSpawn", getLocalPlayer(), explosionOnSpawn )

See Also

Client player events


Client event functions