Gamemode.CanStartRound

From GMod Wiki

Jump to: navigation, search
Event Hook
Hook NameCanStartRound
SyntaxGM:CanStartRound( Number iNum )
DescriptionCalled before a round begins in a round based game. Return true to allow a new round to begin
ReturnsNil
Lua StateNewerServer.png
BBCode[b][url=wiki.garrysmod.com/?title=Gamemode.CanStartRound]Gamemode.CanStartRound [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b]


Examples

DescriptionChecks to see if both teams have at least one player. If they don't, the round can't start.
Used onNewerServer.png
Code
function GM:CanStartRound( iNum )
     if team.NumPlayers( TEAM_RED ) > 0 and team.NumPlayers( TEAM_BLUE ) > 0 then
          return true
     else
          return false
     end
end
OutputReturns true if both teams have at least one player, and false otherwise.
Personal tools
Namespaces
Variants
Actions
Navigation
Lua Scripting
Functions
Hooks
Toolbox