Skip to content

API: Rounds

Robert Fraser edited this page Aug 27, 2019 · 1 revision

Hooks

  • PreRoundStart

    Called when a round is reset. Usually used to clean up the map/round data before a round starts.

  • RoundStart

    Called when the round starts. Useful to kickstart the action!

  • RoundEnd

    Can add additional round end logic. This can be used to assign points to players.

Functions

GM:HandleEndRound(reason)

Determines the winners of the round. The default logic is usually based on who is surviving or who has the most point. For gamemodes with interesting behaviour when the timer ends, override this function.

GM:CanRoundStart()

Returns whether or not the round can start or not. By default, this checks if there is at least 2 players for FFA gamemodes or at least 1 player per team for team gamemodes.

GM:PreStartRound()

This is called just before the round starts. This usually cleans up the map and resets other round data. You probably should not override this function.

GM:StartRound()

This is called when the round starts. This is a short time after PreStartRound. This unfreezes all players and starts the countdown.

GM:EndRound(reason, extra)

This is called when the round ends. You can call this function with a string or player as the argument to end the round when a given condition is met.

GM:EndGame()

This is called when the number of rounds has been reached, and starts the voting process for the next map.

GM:CheckRoundEnd()

This is called to check if the round can end. This usually checks for things like when all players on a team have been eliminated.