GM:PlayerSelectSpawn

From Garry's Mod
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