SpawnPlayer: 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]]
__NOTOC__  
__NOTOC__  
{{Needs_Checking|Merge with [[spawnPlayer (2)]]|[[User:EAi|EAi]]}}
This function spawns the player at a spawnpoint or at an arbitary point on the map.
 
This function spawns the player at a spawnpoint


==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool spawnPlayer ( player thePlayer, element spawnpoint )             
bool spawnPlayer ( player thePlayer, element spawnpoint )             
</syntaxhighlight>  
</syntaxhighlight>
'''OR'''
<syntaxhighlight lang="lua">
bool spawnPlayer ( player thePlayer, float x, float y, float z, int rotation, int skinID )
</syntaxhighlight>


===Required Arguments===  
===Required Arguments===  
*'''thePlayer:''' the player to spawn
*'''thePlayer:''' the player to spawn
*'''spawnpoint:''' the spawnpoint element at which to spawn the player
*'''spawnpoint:''' the spawnpoint element at which to spawn the player
*'''x:''' The x co-ordinate to spawn the player at
*'''y:''' The x co-ordinate to spawn the player at
*'''z:''' The x co-ordinate to spawn the player at
*'''rotation:''' rotation of the player on spawn
*'''skinID:''' players skin on spawn


===Returns===
===Returns===
Line 19: Line 24:


==Example==  
==Example==  
This example does...
This example spawns all the players in the map at the first spawnpoint there is.
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
--This line does...
-- Get a table of all the players
blabhalbalhb --abababa
players = getElementsByType ( "player" )
--This line does this...
-- Get a table of all the spawnpoints
mooo
spawnpoints = getElementByType ( "spawnpoint" )
-- Go through every player
for playerKey, playerValue in players do
-- Spawn them at the first spawnpoint
spawnPlayer ( playerValue, spawnpoints[1] )
end
</syntaxhighlight>
</syntaxhighlight>


==See Also==
==See Also==
{{FunctionArea_Functions}}
{{Player_Functions}}

Revision as of 02:18, 29 May 2006

This function spawns the player at a spawnpoint or at an arbitary point on the map.

Syntax

bool spawnPlayer ( player thePlayer, element spawnpoint )             

OR

bool spawnPlayer ( player thePlayer, float x, float y, float z, int rotation, int skinID )

Required Arguments

  • thePlayer: the player to spawn
  • spawnpoint: the spawnpoint element at which to spawn the player
  • x: The x co-ordinate to spawn the player at
  • y: The x co-ordinate to spawn the player at
  • z: The x co-ordinate to spawn the player at
  • rotation: rotation of the player on spawn
  • skinID: players skin on spawn

Returns

Returns true if the player was spawned successfully, false otherwise.

Example

This example spawns all the players in the map at the first spawnpoint there is.

-- Get a table of all the players
players = getElementsByType ( "player" )
-- Get a table of all the spawnpoints
spawnpoints = getElementByType ( "spawnpoint" )
-- Go through every player
for playerKey, playerValue in players do
	-- Spawn them at the first spawnpoint
	spawnPlayer ( playerValue, spawnpoints[1] )
end

See Also

Template:Player Functions