GM/PlayerSelectSpawn

From Garry's Mod
Revision as of 19:02, 13 October 2015 by Robotboy655 (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search
 GM:PlayerSelectSpawn( )

Contents

Description

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

Arguments

Player ply

The player who needs a spawn point

Returns

Entity

The spawnpoint entity to spawn the player at

Examples

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


Personal tools
Navigation