Commands/Lua

Reference for console commands, Lua hooks and Lua commands in CS2D.

CS2D Command CS2D Console Commands

Lua Hook Lua Hooks

Lua Command Lua Commands

Category: all (86)

Lua Command game

Categories

Parameters

  • "value"

Info

Returns a game state/setting.
You can use most settings like sv_name to get their current value as string(!). Note that some settings have multiple different commands to set them. In this case the long version of the command should work (e.g. 'sv_gm' does not work with the game command, 'sv_gamemode' does work though). This only works for simple settings which have one parameter.

Moreover you can get the following values:

  • version: string, the current game version

  • dedicated: boolean, true if server is dedicated, false otherwise

  • phase: number, game phase, 0 for freezetime, 1 for actual game

  • round: number, current round

  • timeleft: number, remaining round time in seconds

  • maptimeleft: number, remaining time on map in seconds (float precision), 1000000 if unlimited

  • score_t: number, score of terrorists (rounds won)

  • score_ct: number, score of counter-terrorists (rounds won)

  • winrow_t: number, rounds won in a row by terrorists

  • winrow_ct: number, rounds won in a row by counter-terrorists

  • nextmap: string, the next map in the map cycle (sys/mapcycle.cfg)

  • ticks: number, server ticks (refresh rate / mainloop iterations per second)

  • port: string, UDP port used by the server ("no socket" if failed to open port)

  • bombplanted: boolean, true if bomb is currently planted and blinking, false otherwise

  • sysfolder: string, the system folder/path ("sys" by default, custom value if specified via commandline)



Note: There are multiple different commands to set the same game setting in some cases. E.g.: sv_gm and sv_gamemode. This command only works with one of these alternatives. It's normally the long version (in this sample: sv_gamemode, not sv_gm)!

Note: game will only return values for simple settings which are set with functions with one single parameter.

Attention: This command ALWAYS returns a string when used with game settings! Even if the setting is a number! This is important to know in case you want to use this command with mathematical/boolean operators! It may lead to problems without proper casting!