Skip to content

A Counter-Strike 2 server plugin to help administrators manage custom game modes, settings, and map rotations.

License

Notifications You must be signed in to change notification settings

nickj609/GameModeManager

Repository files navigation

Copyright Nickj609l GitHub License Issues GitHub Downloads (all assets, all releases) GitHub commits since latest release

GameModeManager

A Counter-Strike 2 server plugin to help administrators manage custom game modes, settings, and map rotations.

Inspired by CS2 Modded Dedicated Server by Kus and the CS2 Rock The Vote plugin by Abnerfs.

Description

Tired of manually managing game modes, settings, and maps?

GameModeManager simplifies server administration for Counter-Strike 2 by providing:

  • Admin menus for modes, maps, and settings.
  • Customizable rotation of maps and game modes.
  • Player voting for maps, settings, and game modes.
  • Seamless integration with your existing Rock the Vote (RTV) plugin.
  • Dynamic map lists and menus based on the current game mode or all game modes.
  • Customization options for rotation schedules, commands, voting styles, and languages.

This plugin is perfect for servers with a variety of custom content or those that want to give players more control over their experience.

Enjoying the plugin?

Please drop a ⭐ star in the repository

image

Credits

This plugin utilizes the GameLoop.Vdf library (licensed under the MIT License) for parsing the gamemodes_server.txt file, which is in Valve Data Format.

For creating custom votes, this plugin utilizes the CS2-CustomVotes shared plugin API (licensed under the MIT License).

Requirements

RTV Plugin Compatibility

This plugin is compatible with any RTV plugin using a maplist.txt file.

Screenshot 2024-03-21 161846

Commands

Server Commands
  • css_gamemode <mode> - Sets the current mode.

  • css_rtv_enabled <true|false> - Enables or disables RTV.

Admin Commands
  • !allmaps - Displays an admin menu for changing the map to any map from any game mode.

  • !maps - Displays an admin menu for changing the map.

    It only shows maps for the current game mode.

    Screenshot 2024-06-15 214126

    Screenshot 2024-06-15 215052

  • !map <map name> <workshop id> - Changes the map to the map specified.

    The worksop ID is optional and only required for maps that aren't explicitly set for a given map group.

  • !modes - Displays an admin menu for changing the game mode.

    Screenshot 2024-06-15 214427

    image

  • !mode <mode name> - Changes the game mode to the mode specified.

    For example, for mg_surf you would do !mode surf.

  • !settings - Displays an admin menu for enabling or disabling custom game settings.

    image Screenshot 2024-06-15 215321

  • !setting <enable|disable> <setting name> - Enables or disables a custom game setting.

    For example, for enable_movement_unlock.cfg you would do !setting movement_unlock.

Player Commands
  • !game - Displays a dynamic menu of all game mode manager commands.

    Screenshot 2024-06-15 202045

  • !currentmap - Displays the current map.

    Screenshot 2024-06-15 202240

  • !showmaps - Displays a dynamic menu of all per-map votes that can be created.

    It only shows maps for the current game mode.

    image

    image

  • !showallmaps - Displays a menu of all per-map votes that can be created for all games modes.

  • !currentmode - Displays the current game mode.

    Screenshot 2024-06-15 202302

  • !changemode - Creates a vote to change the game mode (all modes).

    Screenshot 2024-06-08 212539

    image

  • !showmodes - Displays a menu of all per-mode votes that can be created.

    Screenshot 2024-06-08 212831

    image

  • !showsettings - Displays a menu of all per-setting votes that can be created.

    Screenshot 2024-06-08 212803

    Screenshot 2024-06-08 213008

Installation

  1. Install Metamod:Source and Counter Strike Sharp.
  2. Copy addons and cfg folders to /csgo/.
  3. Make sure your gamemodes_server.txt or custom map group file is in VDF Format and contains a list of map groups.
  4. If needed, update each game mode configuration file (i.e. comp.cfg) to include css_gamemode <mode>.
  5. After the first run, update the configuration file GameModeManager.json as detailed below.

Configuration

Important

On the first load, a configuration file will be created in csgo/addons/counterstrikesharp/configs/plugins/GameModeManager/GameModeManager.json.

RTV Settings

Setting Description
Enabled Enables RTV compatibility.
Mode Changes the RTV mode. (0 = maps from current game mode, 1 = maps from all game modes.)
Plugin Default path for the desired RTV plugin (i.e. /addons/counterstrikesharp/plugins/plugin)
MapList Default path for the maplist.txt file to update when the map group or game mode changes.
DefaultMapFormat Enables the default format for adding maps to the map list file: ws:{workshopid}. When disabled: {mapname}:{workshopid}.

Map Settings

Setting Description
Delay Map change change delay in seconds.
Default Default map group on server start (i.e. mg_active).
Style Changes vote menu type (i.e. "chat" or "center").

Vote Settings

Setting Description
Enabled Enables voting.
Maps Enables map votes.
AllMaps Enables all maps votes.
GameModes Enables game mode votes.
GameSettings Enables game setting votes.
Style Changes vote menu type (i.e. "chat" or "center").

Game Settings

Setting Description
Enabled Enables custom game settings.
Folder Default settings folder within /csgo/cfg/.
Style Changes setting menu type (i.e. "chat" or "center").

Command Settings

Setting Description
Map Enables or disables the !map admin command.
Maps Enables or disables the !maps admin command.
AllMaps Enables or disables the !allmaps admin command.
TimeLeft Enables or disables the !allmaps admin command.

Rotation Settings

Setting Description
Enabled Enables rotations. (Cannot be enabled when RTV is enabled)
Cycle Changes the rotation cycle. (0 = maps from current mode, 1 = maps from all modes, 2, maps from specific map groups)
MapGroups Mapgroups to use for rotation cycle 2.
ModeRotation Enables game mode rotation. (Cannot be enabled when ModeSchedule is enabled)
ModeInterval Changes game mode every x map rotations. (If ModeRotation is enabled)
ModeSchedule Enables mode schedules. (Cannot be enabled when ModeRotations is enabled)
Schedule Schedule for mode rotations (24-hr format in UTC time)

Game Mode Settings

Setting Description
Delay Delay for changing game modes in seconds.
Default Default mode on server start (i.e. deathmatch).
Style Changes setting menu type (i.e. "chat" or "center").
MapGroupFile Map groups file name in /csgo/. The file must be in VDF Format.
List A customizable list of game modes for your server with friendly names for menus.

Caution

  • All configuration files must be within /csgo/cfg/.
  • Your mode config files must use css_gamemode to cycle the game mode for the plugin.
Click to see Default Values
// This configuration was automatically generated by CounterStrikeSharp for plugin 'GameModeManager', at 2024/06/26 03:02:03
{
  "Version": 5,
  "RTV": {
    "Enabled": false,
    "Mode": 0,
    "MapFormat": false,
    "Plugin": "addons/counterstrikesharp/plugins/RockTheVote/RockTheVote.dll",
    "MapList": "addons/counterstrikesharp/plugins/RockTheVote/maplist.txt"
  },
  "Maps": {
    "Delay": 2,
    "Style": "center",
    "Default": "de_dust2"
  },
  "Votes": {
    "Enabled": false,
    "Maps": false,
    "AllMaps": false,
    "GameModes": false,
    "GameSettings": false,
    "Style": "center"
  },
  "Settings": {
    "Enabled": true,
    "Style": "center",
    "Folder": "settings"
  },
  "Commands": {
    "Map": true,
    "Maps": true,
    "AllMaps": true,
    "TimeLeft": true
  },
  "Rotation": {
    "Cycle": 0,
    "MapGroups": [
      "mg_active",
      "mg_delta"
    ],
    "ModeRotation": true,
    "ModeInterval": 4,
    "ModeSchedules": false,
    "Schedule": [
      {
        "Time": "10:00",
        "Mode": "Casual"
      },
      {
        "Time": "15:00",
        "Mode": "Practice"
      },
      {
        "Time": "17:00",
        "Mode": "Competitive"
      }
    ]
  },
  "GameModes": {
    "Delay": 2,
    "Style": "center",
    "Default": "Casual",
    "MapGroupFile": "gamemodes_server.txt",
    "List": [
      {
        "Name": "Casual",
        "Config": "casual.cfg",
        "MapGroups": [
          "mg_active",
          "mg_delta"
        ]
      },
      {
        "Name": "Competitive",
        "Config": "comp.cfg",
        "MapGroups": [
          "mg_active",
          "mg_delta"
        ]
      },
      {
        "Name": "Wingman",
        "Config": "wingman.cfg",
        "MapGroups": [
          "mg_active",
          "mg_delta"
        ]
      },
      {
        "Name": "Practice",
        "Config": "prac.cfg",
        "MapGroups": [
          "mg_prac"
        ]
      },
      {
        "Name": "Deathmatch",
        "Config": "dm.cfg",
        "MapGroups": [
          "mg_dm"
        ]
      },
      {
        "Name": "Deathmatch Multicfg",
        "Config": "dm-multicfg.cfg",
        "MapGroups": [
          "mg_dm"
        ]
      },
      {
        "Name": "ArmsRace",
        "Config": "armsrace.cfg",
        "MapGroups": [
          "mg_gg"
        ]
      },
      {
        "Name": "GunGame",
        "Config": "gg.cfg",
        "MapGroups": [
          "mg_gg"
        ]
      },
      {
        "Name": "Retakes",
        "Config": "retake.cfg",
        "MapGroups": [
          "mg_retake"
        ]
      },
      {
        "Name": "Executes",
        "Config": "executes.cfg",
        "MapGroups": [
          "mg_executes"
        ]
      },
      {
        "Name": "1v1",
        "Config": "1v1.cfg",
        "MapGroups": [
          "mg_1v1"
        ]
      },
      {
        "Name": "Aim",
        "Config": "aim.cfg",
        "MapGroups": [
          "mg_aim"
        ]
      },
      {
        "Name": "Bhop",
        "Config": "bhop.cfg",
        "MapGroups": [
          "mg_bhop"
        ]
      },
      {
        "Name": "Surf",
        "Config": "surf.cfg",
        "MapGroups": [
          "mg_surf"
        ]
      },
      {
        "Name": "KreedZ",
        "Config": "kz.cfg",
        "MapGroups": [
          "mg_kz"
        ]
      },
      {
        "Name": "Awp",
        "Config": "awp.cfg",
        "MapGroups": [
          "mg_awp"
        ]
      },
      {
        "Name": "Course",
        "Config": "course.cfg",
        "MapGroups": [
          "mg_course"
        ]
      },
      {
        "Name": "Hide N Seek",
        "Config": "hns.cfg",
        "MapGroups": [
          "mg_hns"
        ]
      },
      {
        "Name": "Soccer",
        "Config": "soccer.cfg",
        "MapGroups": [
          "mg_soccer"
        ]
      },
      {
        "Name": "Minigames",
        "Config": "minigames.cfg",
        "MapGroups": [
          "mg_minigames"
        ]
      }
    ]
  }
}

Languages

This plugin will display all in-game menus and messaging based on the player's preferred language. Below is an example language configuration file you can customize to your liking. The CS2-CustomVotes plugin also has additional language files you can configure.

Example Lang
{
  "plugin.prefix": "[{GREEN}Server{DEFAULT}]",
  "game.menu-title": "Game Commands",
  "currentmap.message": "{RED}[Current Map]{DEFAULT} {0}",
  "currentmode.message": "{GREEN}[Current Mode]{DEFAULT} {0}",
  "changemap.message": "Admin {LIGHTRED}{0}{DEFAULT} has changed the map to {LIGHTRED}{1}{DEFAULT}.",
  "changemode.message": "Admin {LIGHTRED}{0}{DEFAULT} has changed the game mode to {LIGHTRED}{1}{DEFAULT}.",
  "enable.changesetting.message": "Admin {LIGHTRED}{0}{DEFAULT} has {LIGHTRED}Enabled{DEFAULT} setting {LIGHTRED}{1}{DEFAULT}.",
  "disable.changesetting.message": "Admin {LIGHTRED}{0}{DEFAULT} has {LIGHTRED}Disabled{DEFAULT} setting {LIGHTRED}{1}{DEFAULT}.",
  "menu.yes": "Yes",
  "menu.no": "No",
  "menu.enable": "Enable",
  "menu.disable": "Disable",
  "mode.show.menu-response": "Say {GREEN}!{0}{DEFAULT} to create a vote.",
  "mode.vote.menu-title": "Change game mode to {GOLD}{0}{DEFAULT}?",
  "modes.menu-title": "Game Mode List",
  "modes.vote.menu-title": "Change game mode?",
  "map.vote.menu-title": "Change map to {0}?",
  "maps.menu-title": "Map List",
  "maps.show.menu-response": "Say {GREEN}!{0}{DEFAULT} to create a vote.",
  "setting.vote.menu-title": "Change setting {GOLD}{0}{DEFAULT}?",
  "setting.show.menu-response": "Say {GREEN}!{0}{DEFAULT} to create a vote.",
  "settings.menu-actions": "Setting Actions",
  "settings.menu-title": "Setting List",
  "timeleft.prefix": "{RED}[Timeleft]{DEFAULT}",
  "timeleft.remaining-rounds": "{0} round(s) remaining",
  "timeleft.remaining-time-hour": "Remaining time {0}:{1}:{2}",
  "timeleft.remaining-time-minute": "Remaining time {0} minute(s) and {1} second(s)",
  "timeleft.remaining-time-second": "Remaining time {0} second(s)",
  "timeleft.no-time-limit": "There is no time limit",
  "timeleft.remaining-last-round": "This is the last round",
  "timeleft.remaining-time-over": "Time is over, this is the last round"
}

Logging

Warning

Due to the need to parse map groups and settings, you may have difficulties initially configuring the plugin, especially if your map group file is not configured properly. All logs associated with this plugin can be found in the below location.

csgo/addons/counterstrikesharp/logs

Example Log
2024-06-08 22:59:32.827 +00:00 [WARN] plugin:GameModeManager Skipping random_setting.cfg because its missing the correct prefix.
2024-06-08 23:05:24.421 +00:00 [INFO] plugin:GameModeManager Current map group is mg_active.
2024-06-08 23:05:24.421 +00:00 [INFO] plugin:GameModeManager New map group is mg_delta.
2024-06-08 24:15:47.044 +00:00 [INFO] plugin:GameModeManager Game has ended. Picking random map from current mode...
Common Error Messages
Error/Warning Message Description
Cannot Find Unable to locate the file specified from GameModeManager.json config.
Incomplete VDF data Your gamemodes_server.txt file is not formatted properly in VDF Format.
Your config file is too old Please backup and remove it from addons/counterstrikesharp/configs/plugins/GameModeManager to recreate it.
The mapgroup property doesn't exist The "mapgroup" property cannot be found in your gamemodes_server.txt file.
Mapgroup found, but the 'maps' property is missing or incomplete The "maps" property cannot be found in your gamemodes_server.txt file for one of your map groups.

FAQ (Frequently Asked Questions)

How do I add custom settings?

To add custom settings, create two configuration files with the enable_ and disable_ prefix (i.e. enable_autobhop.cfg, disable_autobhop.cfg). Then, put those files in the /csgo/cfg/settings/ folder. This is the default settings folder. You can change this folder in the configuration settings.

How do I add game modes?

To add game modes, update the JSON key pairs in the configuration file (csgo/addons/counterstrikesharp/configs/plugins/GameModeManager/GameModeManager.json).

"GameModes": 
{
  "Rotation": true,
  "Interval": 4,
  "DefaultMode": "Casual",
  "Delay": 2,
  "Style": "center",
  "List": {
    "Casual": {
      "casual.cfg": [
        "mg_active",
        "mg_hostage"
      ]
    },
    "Competitive": {
      "comp.cfg": [
        "mg_active",
        "mg_hostage"
      ]
    },
    "Wingman": {
      "wingman.cfg": [
        "mg_wingman"
      ]
    },
    "Deathmatch": {
      "dm.cfg": [
        "mg_dm"
      ]
    },
    "Deathmatch Multicfg": {
      "dm-multicfg.cfg": [
        "mg_dm"
      ]
    },
    "ArmsRace": {
      "ar.cfg": [
        "mg_armsrace"
      ]
    },
    "GunGame": {
      "gg.cfg": [
        "mg_armsrace"
      ]
    },
    "1v1": {
      "1v1.cfg": [
        "mg_1v1"
      ]
    },
    "Aim": {
      "aim.cfg": [
        "mg_aim"
      ]
    },
    "Bhop": {
      "bhop.cfg": [
        "mg_bhop"
      ]
    },
    "Surf": {
      "surf.cfg": [
        "mg_surf"
      ]
    },
    "Awp": {
      "awp.cfg": [
        "mg_awp"
      ]
    },
    "ScoutzKnivez": {
      "scoutzknivez.cfg": [
        "mg_scoutzknivez"
      ]
    },
    "Soccer": {
      "soccer.cfg": [
        "mg_soccer"
      ]
    },
    "HE Only": {
      "minigames.cfg": [
        "mg_he"
      ]
    }
  }
}
What are game mode and map rotations not working?

Game mode and map rotations do not work if RTV compatibility is enabled. Game mode and map rotations are only counted when handled by the plugin's game event handler.

Why is RTV not working?

You need to install your own supported RTV plugin and update the JSON configuration file. Any RTV plugin with a maplist.txt file is supported.

"RTV": {
  "Enabled": false,
  "Plugin": "addons/counterstrikesharp/plugins/RockTheVote/RockTheVote.dll",
  "MapListFile": "addons/counterstrikesharp/plugins/RockTheVote/maplist.txt",
  "DefaultMapFormat": false
},
How are friendly names generated for settings?

Friendly names for settings are generated by removing the extension and underscores, and capitalizing the first letter of each word. For example, enable_movement_unlock.cfg turns into Movement Unlock.

How are vote commands created?

Vote commands for categories are set manually, such as !changemode. This may be configurable in the future, with the addition of aliases. Per-map commands are generated based on the map name (i.e. de_dust2). Per-mode commands are generated from the game mode list or the map group name (without the mg_ prefix).