GM/PlayerSelectSpawn

From Garry's Mod
Revision as of 16:06, 13 August 2019 by Robotboy655 (Talk | contribs)
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

Arguments

boolean transition

Next Update Change

This feature is only available in the next update.
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

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