Garry's Mod Wiki

GM:PlayerSelectSpawn

Entity GM:PlayerSelectSpawn( Player ply, boolean transition )

Description

Called to determine a spawn point for a player to spawn at.

Arguments

1 Player ply
The player who needs a spawn point
2 boolean transition
If true, the player just spawned from a map transition. You probably want to not return an entity for that case to not override player's position.

Returns

1 Entity
The spawnpoint entity to spawn the player at

Example

Find a random spawn point

function GM:PlayerSelectSpawn( pl ) local spawns = ents.FindByClass( "info_player_start" ) local random_entry = math.random( #spawns ) return spawns[ random_entry ] end

Page Links


Special Pages


Wikis

?

Render Time: 31ms

Session 0
DB GetPage 3
Generate Html 7
SaveChanges 8
Render Body 0
Render Sidebar 11