Skip to content

ssypchenko/GG1MapChooser

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

77 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GG1MapChooser

The GG1MapChooser plugin enhances map selection and management for CS2 game servers. It introduces robust controls over map voting, nominations, and automatic map rotation based on player counts and preferences.

Features

  • Map Voting System - Players can vote on which maps to play next. If no one votes, the plugin chooses a random map from the list.
  • Rock The Vote (rtv) - Players can request to start a vote for a new map during the game.
  • Map Nominations - Players can nominate maps for voting.
  • Player Count Thresholds - Specify minimum and maximum player counts for maps to be included in the vote.
  • Map display names - Maps can have nice display names in the settings file, for example "Mini Circular" instead of "gg_mini_circular" which is the workshop name.
  • Map Weights - Randomly selects maps to vote for the next map with configurable weights. The higher the weight, the more likely the map will be included in the vote list.
  • Admin Commands - Includes commands for admins to start voting, to vote if players want to change the map, to simply change or set the next map .
  • Map load at the game end - If this set in the config, plugin will be responsible for the load of the winning in vote map.
  • Maps log in Discord - Voted or/and Loaded map can be logged in a Discord text channel with configurable template.

Configuration Files

Map Configuration

Define map settings in csgo/cfg/GGMCmaps.json:

  • Minimum and maximum player counts for map eligibility (not mandatary parameter).
  • Map weighting (default is "1") (not mandatary parameter).
  • Specify if it is a Workshop or classic map.
  • Set the Display name for map if necessary.
  • For Workshop maps, set the workshop map ID to use maps without a collection.

Plugin Settings

Customize plugin behaviour in csgo/addons/counterstrikesharp/configs/plugins/GG1MapChooser/GG1MapChooser.json.
Config file is divided into sections to simplify plugin configuration:

  • VoteSettings - describe the process of voting itself.
  • RTVSettings - specific settings for Rock the Vote.
  • WinDrawSettings - voting settings which depends of Rounds Wins
  • TimeLimitSettings - voting settings which depends of Map TimeLimit if set (mp_timelimit cvar)
  • DiscordSettings - to define reporting to Discord behaviour.
  • MenuSettings - menu behaviour.
  • OtherSettings - settings related to different aspects of the plugin.

VoteSettings

  • RememberPlayedMaps - Number of recent maps to exclude from upcoming votes.
  • MapsInVote - Number of maps in the voting pool (5 is the recommended value).
  • VotesToWin - Percentage of votes needed to win the vote (0.6 (60%) is the recommended value).
  • AllowNominate - Allow Nomination.
  • NominationsWASDMenu - Nomination in WASD menu (true) (navigation by buttons W (up), S (down), A (previous menu), E ("use" command - select menu item), R ("reload" command to exit)) or in Chat Menu (false).
  • EndMapVoteWASDMenu - End of Map Vote in WASD menu (true) or in Chat menu (false).
  • VotingTime - Duration for players to cast their votes. Can be overridden in console commands.
  • ExtendMapInVote - Set to true to add the "Extend Map" menu item. It increases the "mp_timelimit" variable.
  • ExtendMapTimeMinutes - Time in minutes to increase the "mp_timelimit" variable.
  • ChangeMapAfterVote - Plugin will Change the Map immediately after the vote.

RTVSettings

  • AllowRTV - Allow RTV.
  • RTVDelayFromStart - Time delay from the start of the map during which RTV is disabled.
  • IntervalBetweenRTV - Cooldown period after a failed vote.
  • NoRTVafterRoundsPlayed - Set number of rounds from the map start when rtv can't be called. 0 - to disable this feature

WinDrawSettings

  • VoteDependsOnRoundWins - Turns on/off this section. Set to true if the vote start depends on the number of wins or rounds played.
  • TriggerRoundsBeforeEnd - Number of rounds before the end of the match to start the vote. 0 - after the win or last round, 1 - one round before the last win, etc.
  • TriggerRoundsBeforEndVoteAtRoundStart - Vote which is triggered in number of rounds before the game end should be executed on RoundStart if true and RoundEnd if false.
  • TriggerVoteAtRoundStartSecondsFromStart - Vote which is executed on RoundStart will have this delay in seconds from the RoundStart.
  • ChangeMapAfterWinDraw - Plugin will Change the Map after the end of the game if a map selected after the vote.

TimeLimitSettings

  • VoteDependsOnTimeLimit - Turns on/off this section. Set to true if the vote start depends on the time limit to play. The map time is defined in cvar "mp_timelimit"
  • TriggerSecondsBeforEnd - Number of seconds before the end of the map to start the vote. Leave enough time for the Vote duration set in "VotingTime"
  • ChangeMapAfterTimeLimit - Plugin will Change the Map if it is selected in vote after the end of the time limit.
  • VoteNextRoundStartAfterTrigger - if there are several rounds during the time limit, the vote will start on the next RoundStart after being triggered by "TriggerSecondsBeforEnd".

DiscordSettings

  • DiscordWebhook - Discord webhook link to report loaded maps in a Discord channel.
  • DiscordMessageMapStart - Reports the map start event to Discord.
  • DiscordMessageAfterVote - Reports the vote result to Discord.
  • PictureExtension - To display map images in the Discord channel, the link to the folder containing the images can be included in the message template. The specific link to the image is created by combining the workshop map name and the file extension defined by this parameter.

MenuSettings

  • SoundInMenu - Turns on (true) / off (false) sounds in menu for navigation between options, open and close menu.
  • FreezePlayerInMenu - If true, a player will be frozen while navigating the menu.
  • FreezeAdminInMenu - If true, an admin will be frozen while navigating the menu.

OtherSettings

  • PrintPlayersChoiceInChat - Print Player's menu choice to other players in Chat.
  • PrintNextMapForAll - Print NextMap command result for all players if true.
  • DelayBeforeChangeSeconds - Delay before Plugin will Change the Map after the events: Win/Draw event (ChangeMapAfterWinDraw); Vote ended (ChangeMapAfterVote)
  • VoteStartSound - Sound played to players when the map vote starts.
  • RandomMapOnStart - Enable changing to a random map on server restart.
  • RandomMapOnStartDelay - Delay in seconds before changing to a random map on server restart.
  • LastDisconnectedChangeMap - Switch to a random map after the last player disconnects.
  • WorkshopMapProblemCheck - Checks whether the voted or admin-chosen map is loaded and if not (in case of problems with the workshop map) loads a random map.

Discord message Configuration

Define the text you want to display in csgo/addons/counterstrikesharp/configs/plugins/GG1MapChooser/NextMapMessage.json:

  • The config file will be automatically created if not exists.
  • You can modify or localize the text: content = "Next map: "
  • If you want to display map pictures in the messages you need to specifying the resource’s address: url = "https://example.com/folder/with/mapimages/"
  • Map images must follow the naming convention plus extension defined in "PictureExtension", matching exactly with the map names used in the Workshop and in GGMCmaps.json

Usage

  • Voting: Players can initiate a map vote using !rtv or rtv in chat. The required percentage of votes to start a vote is controlled by the VotesToWin setting.
  • Nominating: Players can nominate a map by typing !nominate <mapname> or simply nominate to bring up a list of eligible maps based on current server conditions.
  • Re-Vote: After the vote has been taken, or if the voting menu has been accidentally closed, players can revote using the "!revote" command in chat.

Setup Examples

  • If you call the vote from external plugin you have two options:
    • Use ggmc_mapvote_start if the external plugin ends the game so the server will change the map after the Win/Draw
    • Use ggmc_mapvote_with_change command if you want that mapchooser changes the map itself immediately after the vote.

    In that case you need to have "ChangeMapAfterWinDraw": false, "ChangeMapAfterVote": false, "VoteDependsOnRoundWins": false, "VoteDependsOnTimeLimit": false.

  • If the vote is completed mid-game and automatic map change settings are not viable (e.g., maps outside of the collection), command ggmc_change_nextmap can be used in server scripts at the end of the game.
  • Voting Before the End of Multiple Rounds:
    • To have a vote before the game ends, set the following configuration:
      • "ChangeMapAfterWinDraw": true,
      • "ChangeMapAfterVote": false,
      • "VoteDependsOnRoundWins": true.
    • In the "TriggerRoundsBeforeEnd" parameter, specify the number of rounds before the end of the game to trigger the vote (set this value greater than 0).
    • Use "TriggerRoundsBeforEndVoteAtRoundStart": true to start the vote at the beginning of the specified round or false to start the vote at the end of that round.
    • Triggering the Vote:
      • If "TriggerRoundsBeforeEnd" is set to 1:
        • The vote will be triggered at the beginning of the last round.
        • If "TriggerRoundsBeforEndVoteAtRoundStart" is set to false, the vote will start at the end of the last round, right when you see the winners and the standard voting interface appears on the screen.
    • Handling Early Round Endings:
      • Even if the vote is triggered at the start of the last round, the round may end before the vote finishes.
      • To accommodate this, and if your vote is scheduled for the very end of the game, set the mp_endmatch_votenextleveltime cvar to a duration long enough to allow the plugin to complete the vote (VotingTime) and change the map (add an extra 5 seconds).
    • Note on Post-Game Voting:
      • Be aware that once the game finishes, the WASD menu will not be shown, and votes via chat may not be allowed.
  • If you play one long round or just limited time and want to have the vote before tha end of that time (defined in mp_timelimit), you set:
    "VoteDependsOnTimeLimit": true, "ChangeMapAfterTimeLimit": true, "ChangeMapAfterWinDraw": false, "ChangeMapAfterVote": false, "VoteDependsOnRoundWins": false. Take attention that "TriggerSecondsBeforEnd" should be more that "VotingTime", otherwise the vote will not have time to finish.

Admin Commands

  • Map Change: Use css_maps or !maps to open a menu with options: simply change the map (manually choose or automatic selection); start a vote with automatic or custom selections; start a vote to see if players agree to change the map; set the next map.
  • Players or admins confirm WASD menu options using the “E” button (“use” command).
  • Quick Map Selection: Use ggmap <partofmapname> to quickly find and switch to a map using a partial name match. Or you can use ggmap <exactmapname> as aa server command to change a map from external scripts or plugins.

External Controls:

  • ggmc_mapvote_start [time] - Trigger a map vote externally with an optional time parameter. This command starts the vote with automatic map selection and sets the "nextlevel" cvar to the winning map. This command can only be used with maps in the map list (GGMCmaps.json) from the collection or classic maps. In GunGame, we use it in the gungame.mapvote.cfg file to start the vote after the win or at a specified number of levels before the win.
  • ggmc_mapvote_with_change [time] - Trigger a map vote externally with an optional time parameter and immediate map change after the vote ends. This command can be used with set workshop map IDs in the map list (GGMCmaps.json).
  • ggmc_auto_mapchange - Automatically change to a random map.
  • ggmc_nortv - Temporarily disable the RTV command to maintain game continuity.
  • ggmc_change_nextmap - Immediately changes the map to the previously voted map. .

Other Commands:

  • reloadmaps - Command to reload maps file. It reloads every map start, but you can reload it manually if necessary.
  • setnextmap - Command to set the next map without voting.

Important Notes About Usage

  • If the server has an assigned maps collection (+host_workshop_collection [collection number]), the map list in GGMCmaps.json can have map names for the workshop maps from the assigned collection without "mapid".
  • If maps are not from the collection, please fill in the "mapid" parameter with the map number in the map list.
  • If a map ID is set for the workshop map, the plugin will use it to change the map. If the map ID is not set, the plugin will try to change the map by the name, but if it is not included in the collection assigned to the server - nothing will happen. Workshop maps that are not from the collection cannot be used to set "nextlevel" when using the "ggmc_mapvote_start" command.
  • Even if a map ID is set for the workshop map, it is important to have the name the maps exactly the same as it is in the Workshop. Otherwise, you won't be able to use the WorkshopMapProblemCheck feature to check if the requested map is loaded or if it is missing in the workshop, because the map owner can delete the map at any time.

Plugin Compilation

To compile the plugin by yourself please download the APi part.

Plugin APIs

Plugin expose to other developers these functions via API:

  • Maps API:
    • public bool GGMC_IsVoteInProgress(); - confirms whether the vote in progress now.
  • WASD Menu API:
    • public IWasdMenu CreateMenu(string title = "", bool freezePlayer = true); - create new menu object;
    • public void OpenMainMenu(CCSPlayerController? player, IWasdMenu? menu); - open the menu as main menu;
    • public void CloseMenu(CCSPlayerController? player); - close all menus;
    • public void OpenSubMenu(CCSPlayerController? player, IWasdMenu? menu); - open menu as submenu;
    • public void CloseSubMenu(CCSPlayerController? player); - close current submenu and go to previous menu/submenu;
    • public void CloseAllSubMenus(CCSPlayerController? player); - close all submenus and go to main menu;

Disclaimer

The plugin is provided "as-is" and fulfills the specific requirements it was designed for. While I am not planning further major updates, I welcome suggestions that might benefit a broader user base, which could lead to additional features.

Credits

Thank you to UMC Mapchooser for the main ideas.

Special thanks to T3Marius for WASD menu ideas and design.

Thanks to:

  • crashzk for the Portuguese translation,
  • YuYueCraft for Chinese translation.

Donations

Donate with PayPal

About

Map changing management for CS2 on CounterStrikeSharp

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 3

  •  
  •  
  •  

Languages