spawnPlayer | Multi Theft Auto: Wiki Skip to content

spawnPlayer

Client-side
Server-side
Shared

This page is incomplete! Help wanted!

Please finish this page using the corresponding Old Wiki article.
Go to Contribution guidelines for more information.


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

Note

setCameraTarget must be used to focus on the player. Also, all players have their camera initially faded out after connect. To ensure that the camera is faded in, please do a fadeCamera after.

Syntax

spawnPlayer ( )

Code Examples

server

This example spawns all the players in the middle of the game map.

-- Get a table of all the players
local players = getElementsByType ( "player" )
-- Go through every player
for _, player in ipairs(players) do
-- Spawn them at the desired coordinates
spawnPlayer ( player, 0.0, 0.0, 5.0, 90.0, 0 )
fadeCamera ( player, true)
setCameraTarget ( player, player )
end

See Also