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.
  • Automatic rotation for maps and game modes.
  • Player voting for maps, settings, and game modes.
  • Seamless integration with your existing Rock the Vote (RTV) plugin.
  • Dynamic map list and menu updates based on the current game mode.
  • Customization options for settings folders, 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_rtv <true|false> - Enables or disables RTV.

  • css_mapgroup <mg_name> - Sets the current map group.

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

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

  • !maps (css_maps) - Displays a dynamic admin menu for changing the map.

    It only shows maps for the current game mode/map group.

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

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

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

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

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

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

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

    Screenshot 2024-06-08 212539

    Screenshot 2024-06-08 212613

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

    Screenshot 2024-06-08 212831

    Screenshot 2024-06-08 213033

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

    Screenshot 2024-06-08 212803

    Screenshot 2024-06-08 213008

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

    Screenshot 2024-06-08 212858

    Screenshot 2024-06-08 212923

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.

    If you are not using the JSON configuration file for specifying game modes, include the "displayname" property within your gamemodes_server.txt or custom map group file for each map group.

    Example
    "mg_dm"
     {
     	"imagename"				"mapgroup-bomb"
     	"displayname"				"Deathmatch"
     	"nameID"				"#SFUI_Mapgroup_allclassic"
     	"tooltipID"				"#SFUI_MapGroup_Tooltip_Desc_DeathMatch"
     	"name"					"mg_dm"
     	"icon_image_path"			"map_icons/mapgroup_icon_deathmatch"
     	"maps"
     	{
     		"ar_shoots"						""
     		"ar_baggage"						""
     		"workshop/3070550406/de_safehouse"			""
     		"workshop/3070563536/de_lake"				""
     		"workshop/3070581293/de_bank"				""
     		"workshop/3070923343/fy_pool_day"			""
     		"workshop/3070238628/fy_iceworld"			""
     	}
     }
    
  4. If needed, update each game mode configuration file (i.e. comp.cfg) to include css_mapgroup <map group>.

  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.
Plugin Default path for the desired RTV plugin.
MapListFile 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}.

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").

Map Group Settings

Setting Description
Delay Map change change delay in seconds.
Default Default map group on server start (i.e. mg_active).
File Map groups file name in /csgo/. The file must be in VDF Format.

Game Mode Settings

Setting Description
Rotation Enables game mode rotation.
Interval Changes game mode every x map rotations.
Delay Delay for changing game modes in seconds.
Style Changes setting menu type (i.e. "chat" or "center").
ListEnabled Uses the game mode list in the config. Otherwise, the list is generated from map groups.
List A customizable list of game modes for your server with friendly names for menus.

Vote Settings

Setting Description
Enabled Enables voting.
Map Enables map vote.
GameMode Enables game mode votes.
GameSetting Enables game setting votes.
Style Changes vote menu type (i.e. "chat" or "center").

Caution

  • All configuration files must be within /csgo/cfg/.
  • Your mode config files must use css_mapgroup to cycle the current map group.
Click to see Default Values
// This configuration was automatically generated by CounterStrikeSharp for plugin 'GameModeManager', at 2024/06/08 09:52:11
{
  "Version": 2,
  "RTV": {
    "Enabled": false,
    "Plugin": "addons/counterstrikesharp/plugins/RockTheVote/RockTheVote.dll",
    "MapListFile": "addons/counterstrikesharp/plugins/RockTheVote/maplist.txt",
    "DefaultMapFormat": false
  },
  "MapGroup": {
    "Delay": 5,
    "Default": "mg_active",
    "File": "gamemodes_server.txt"
  },
  "Settings": {
    "Enabled": true,
    "Folder": "settings",
    "Style": "center"
  },
  "GameMode": {
    "Rotation": true,
    "Interval": 4,
    "Delay": 5,
    "Style": "center",
    "ListEnabled": true,
    "List": {
      "comp": "Competitive",
      "1v1": "1 vs 1",
      "aim": "Aim",
      "awp": "AWP Only",
      "scoutzknivez": "ScoutzKnives",
      "wingman": "Wingman",
      "gungame": "Gun Game",
      "surf": "Surf",
      "dm": "Deathmatch",
      "dm-multicfg": "Deathmatch Multicfg",
      "course": "Course",
      "hns": "Hide N Seek",
      "kz": "Kreedz",
      "minigames": "Mini Games"
    }
  },
  "Votes": {
    "Enabled": false,
    "Map": false,
    "GameMode": false,
    "GameSetting": false,
    "Style": "center"
  },
  "ConfigVersion": 2
}

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}]",
  "changemap.message": "{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"
}

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.805 +00:00 [INFO] plugin:GameModeManager Loading map groups...
2024-06-08 22:59:32.821 +00:00 [INFO] plugin:GameModeManager Creating game modes...
2024-06-08 22:59:32.823 +00:00 [INFO] plugin:GameModeManager Loading settings...
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 22:59:32.835 +00:00 [INFO] plugin:GameModeManager Enabling game mode and map rotations...
2024-06-08 22:59:34.096 +00:00 [INFO] plugin:GameModeManager Registering custom votes...
2024-06-08 23:01:12.832 +00:00 [WARN] plugin:GameModeManager New map group could not be found. Setting default map group.
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_active.
2024-06-08 24:15:47.044 +00:00 [INFO] plugin:GameModeManager Game has ended. Picking random map from current map group...
2024-06-08 24:17:76.044 +00:00 [INFO] plugin:GameModeManager Deregistering custom votes...
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). The first value is the name of the configuration file to be executed (i.e. comp for comp.cfg)

"GameMode": {
    "Rotation": true,
    "Interval": 4,
    "Delay": 5,
    "Style": "center",
    "ListEnabled": true,
    "List": {
      "comp": "Competitive",
      "1v1": "1 vs 1",
      "aim": "Aim",
      "awp": "AWP Only",
      "scoutzknivez": "ScoutzKnives",
      "wingman": "Wingman",
      "gungame": "Gun Game",
      "surf": "Surf",
      "dm": "Deathmatch",
      "dm-multicfg": "Deathmatch Multicfg",
      "course": "Course",
      "hns": "Hide N Seek",
      "kz": "Kreedz",
      "minigames": "Mini Games"
    }

If you have ListEnabled set to false, game modes are generated based on the map groups in your map group file (default is gamemodes_server.txt).

Why are friendly names not working?

Friendly names may not be working if you are not using the game mode list in the configuration file. This is because you need to add the displayname property to each map group in your map group file (default is gamemodes_server.txt).

  "mg_dm"
	{
		"imagename"				"mapgroup-bomb"
		"displayname"				"Deathmatch"
		"nameID"				"#SFUI_Mapgroup_allclassic"
		"tooltipID"				"#SFUI_MapGroup_Tooltip_Desc_DeathMatch"
		"name"					"mg_dm"
		"icon_image_path"			"map_icons/mapgroup_icon_deathmatch"
		"maps"
		{
			"ar_shoots"						""
			"ar_baggage"						""
			"workshop/3070550406/de_safehouse"			""
			"workshop/3070563536/de_lake"				""
			"workshop/3070581293/de_bank"				""
			"workshop/3070923343/fy_pool_day"			""
			"workshop/3070238628/fy_iceworld"			""
		}
	}
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).