SpawnPlayer: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
Line 4: Line 4:
==Syntax [spawn at arbitary point]==
==Syntax [spawn at arbitary point]==
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool spawnPlayer ( player thePlayer, float x, float y, float z, int rotation, int skinID )
bool spawnPlayer ( player thePlayer, float x, float y, float z, int rotation, int skinID, [ int interior = 0, team theTeam = nil )
</syntaxhighlight>
</syntaxhighlight>


Line 13: Line 13:
*'''rotation:''' rotation of the player on spawn
*'''rotation:''' rotation of the player on spawn
*'''skinID:''' players skin on spawn
*'''skinID:''' players skin on spawn
===Optional Arguments===
*'''interior:''' interior the player will spawn into
*'''theTeam:''' the team the player will join


===Returns===
===Returns===

Revision as of 23:55, 6 October 2006

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

Syntax [spawn at arbitary point]

bool spawnPlayer ( player thePlayer, float x, float y, float z, int rotation, int skinID, [ int interior = 0, team theTeam = nil )

Required Arguments

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

Optional Arguments

  • interior: interior the player will spawn into
  • theTeam: the team the player will join

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" )
-- Go through every player
for playerKey, playerValue in players do
	-- Spawn them at the desired coordinates
	spawnPlayer ( playerValue, 0.0, 0.0, 0.0, 90.0, 7 )
end

See Also