Gamemode.PlayerSelectSpawn

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NamePlayerSelectSpawn
SyntaxGM:PlayerSelectSpawn( Player Player )
DescriptionCalled whenever a player dies and needs to respawn.
ReturnsReturns the entity object of the spawn point.
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.PlayerSelectSpawn]Gamemode.PlayerSelectSpawn [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionFind a random spawn point
Used onNewerServer.png
Code
function GM:PlayerSelectSpawn( pl )
 
    local spawns = ents.FindByClass( "info_player_start" )
    local random_entry = math.random(#spawns)
 
    return spawns[random_entry]
 
end
OutputN/A


Additional Notes

Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox