Gamemode.PlayerSelectSpawn

From GMod Wiki

Revision as of 16:29, 25 September 2009 by Crazy Quebecer (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
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