From 9e8ec809f98aa29ae123dad7e8aa9d3cadc01dc3 Mon Sep 17 00:00:00 2001 From: Resxt <55228336+Resxt@users.noreply.github.com> Date: Sun, 6 Aug 2023 21:51:28 +0200 Subject: [PATCH] mapvote 1.1.3 The mapvote is now enabled by default (mapvote_enable set to 1 by default instead of 0) The default rotation system now has an additional dvar dedicated to enabling/disabling it, it no longer relies on the player count dvar to be enabled or disabled which allows it to work with the min and max dvars set to 0 (only rotate the default rotation if there's no human player) --- mapvote/README.md | 20 +++++++++++--------- mapvote/mapvote.gsc | 19 ++++++------------- 2 files changed, 17 insertions(+), 22 deletions(-) diff --git a/mapvote/README.md b/mapvote/README.md index 124cb7f..5c3914e 100644 --- a/mapvote/README.md +++ b/mapvote/README.md @@ -33,21 +33,21 @@ Huge thanks to him. ### Getting started -By default the script is disabled to avoid running on all your servers. -Simply set `mapvote_enable` to 1 and the script will be loaded, which as a result will display the voting menu when the game ends (after the killcam). - To configure the menu before putting it on your server I recommend running it in a custom game with the `mapvote_debug` dvar set to `1`. -To do that use this command in the console `set mapvote_enable 1;set mapvote_debug 1` before running a custom game. +To do that use this command in the console `set mapvote_debug 1` before running a custom game. Start a custom game and you will see the menu. You can then configure the dvars directly in your console and restart the map with `map_restart` in the console to edit the menu quickly and get your perfect setup. +Note that by default the mapvote will be activated on all of your servers. +If you run multiple servers and want it off on certain servers you will need to add `set mapvote_enable 0` in the server's CFG. + ### Dvars Here are the dvars you can configure: - - | Name | Description | Default value | Accepted values | + +| Name | Description | Default value | Accepted values | |---|---|---|---| -| mapvote_enable | Toggle whether the mapvote is activated or not. 0 is off and 1 is on | 0 | 0 or 1 | +| mapvote_enable | Toggle whether the mapvote is activated or not. 0 is off and 1 is on | 1 | 0 or 1 | | mapvote_debug | Toggle whether the mapvote runs in debug mode or not. This will display the mapvote menu a few seconds after starting the game. 0 is off and 1 is on | 0 | 0 or 1 | | mapvote_maps | A list of the maps that are available for rotation | Every maps including DLC maps and Plutonium DLC maps (excluding [Face Off maps](https://callofduty.fandom.com/wiki/Face_Off#Modern_Warfare_3)) | Any text followed by a comma (,) and then the map code name (mapname). Each block is separated with a colon (:). A single space `" "` is also accepted if you don't want any maps for this dvar | | mapvote_modes | A list of the modes that are available for rotation. The first parameter is how the mode will be displayed, it can be set to anything you like, the second parameter is the name of the DSR file to load | "Team Deathmatch,TDM_default:Domination,DOM_default" | Any text followed by a comma (,) and then the cfg name. Each block is separated with a colon (:) | @@ -69,10 +69,11 @@ Here are the dvars you can configure: | mapvote_blur_fade_in_time | The time (in seconds) it takes for the blur to reach `mapvote_blur_level`. For example if you set it to 10 and `mapvote_blur_level` is 5 then it will progressively blur the screen from 0 to 5 in 10 seconds | 2 | Any number | | mapvote_horizontal_spacing | The horizontal spacing between the map/mode names on the left and the vote counts on the right. I recommend setting this value according to the longest map or mode name length so that it doesn't overlap with the vote counts | 75 | Any plain number | | mapvote_display_wait_time | Once the killcam ends, the time to wait before displaying the vote menu (in seconds) | 1 | Any number superior or equal to 0.05 | +| mapvote_default_rotation_enable | Toggle whether the default rotation system is activated or not. This allows you to have one or more map(s) and mode(s) rotate by default when the human player count is between `mapvote_default_rotation_min_players` and `mapvote_default_rotation_max_players` 0 is off and 1 is on | 0 | 0 or 1 | | mapvote_default_rotation_maps | A list of the map code names that are available for default rotation | "mp_dome:mp_nuked:mp_rust" | Any map code name. Each map is separated with a colon (:) | | mapvote_default_rotation_modes | A list of the DSR file names that are available for default rotation | "TDM_default" | Any DSR file name. Each DSR file name is separated with a colon (:) | -| mapvote_default_rotation_min_players | The minimum amount of human players required to rotate the default rotation instead of showing the mapvote. If the human players count is smaller than this then it will display the mapvote | 0 | Any plain number from 0 to 18 | -| mapvote_default_rotation_max_players | The maximum amount of human players required to rotate the default rotation instead of showing the mapvote. If the human players count is higher than this then it will display the mapvote | 0 | Any plain number from 0 to 18 | +| mapvote_default_rotation_min_players | The minimum amount of human players required to rotate the default rotation instead of showing the mapvote. If the human players count is smaller than this then it will display the regular mapvote rotation instead | 0 | Any plain number from 0 to 18 | +| mapvote_default_rotation_max_players | The maximum amount of human players required to rotate the default rotation instead of showing the mapvote. If the human players count is higher than this then it will display the regular mapvote rotation instead | 0 | Any plain number from 0 to 18 | ### Configuration @@ -101,6 +102,7 @@ set mapvote_blur_level 2.5 set mapvote_blur_fade_in_time 2 set mapvote_horizontal_spacing 75 set mapvote_display_wait_time 1 +set mapvote_default_rotation_enable 0 set mapvote_default_rotation_maps "mp_dome:mp_nuked:mp_rust" set mapvote_default_rotation_modes "TDM_default" set mapvote_default_rotation_min_players 0 diff --git a/mapvote/mapvote.gsc b/mapvote/mapvote.gsc index 1c12238..269f969 100644 --- a/mapvote/mapvote.gsc +++ b/mapvote/mapvote.gsc @@ -17,6 +17,8 @@ Init() { + SetDvarIfNotInitialized("mapvote_enable", true); + if (GetDvarInt("mapvote_enable")) { replaceFunc(maps\mp\gametypes\_gamelogic::waittillFinalKillcamDone, ::OnKillcamEnd); @@ -71,6 +73,7 @@ InitDvars() SetDvarIfNotInitialized("mapvote_blur_fade_in_time", 2); SetDvarIfNotInitialized("mapvote_horizontal_spacing", 75); SetDvarIfNotInitialized("mapvote_display_wait_time", 1); + SetDvarIfNotInitialized("mapvote_default_rotation_enable", false); SetDvarIfNotInitialized("mapvote_default_rotation_maps", "mp_dome:mp_nuked:mp_rust"); SetDvarIfNotInitialized("mapvote_default_rotation_modes", "TDM_default"); SetDvarIfNotInitialized("mapvote_default_rotation_min_players", 0); @@ -594,18 +597,6 @@ OnKillcamEnd() return true; } -ShouldRotateDefault() -{ - humanPlayersCount = GetHumanPlayers().size; - - if (GetDvarInt("mapvote_default_rotation_max_players") > 0 && humanPlayersCount >= GetDvarInt("mapvote_default_rotation_min_players") && humanPlayersCount <= GetDvarInt("mapvote_default_rotation_max_players")) - { - return true; - } - - return false; -} - RotateDefault() { DoRotation(GetRandomElementInArray(StrTok(GetDvar("mapvote_default_rotation_modes"), ":")), GetRandomElementInArray(StrTok(GetDvar("mapvote_default_rotation_maps"), ":"))); @@ -620,7 +611,9 @@ DoRotation(modeDsr, mapName) StartRotation() { - if (ShouldRotateDefault()) + humanPlayersCount = GetHumanPlayers().size; + + if (GetDvarInt("mapvote_default_rotation_enable") && humanPlayersCount >= GetDvarInt("mapvote_default_rotation_min_players") && humanPlayersCount <= GetDvarInt("mapvote_default_rotation_max_players")) { RotateDefault(); }