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

hook.Add("PlayerSelectSpawn", "RandomSpawn", function(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: 85ms

DB GetPage 46
Generate Html 11
SaveChanges (1) 13
Render Body 0
Render Sidebar 13