Skip to content

Repository files navigation

[NMRiH] AutoRTV

Automatic map vote after successful extraction.

Overview

This plugin solves a common problem on NMRiH servers: after a successful extraction, the map restarts instead of changing, because players either don't know how to use RTV or simply don't bother. AutoRTV automatically initiates a map change vote when players successfully extract, ensuring the server moves on to a new map.

The vote is triggered at the start of the next round (after the round reset), giving players a clean moment to decide. If the confirm vote option is enabled, players must first agree to change the map before the MapChooser vote begins. During the entire auto-vote process, the standard RTV command is disabled to prevent conflicts.

Features

  • Automatic Map Vote: Triggers a MapChooser map vote after a successful extraction, no player input required.
  • Confirm Vote: Optional yes/no confirmation vote before the map vote. Players vote individually via a menu, and results are shown with colored chat messages.
  • Smart Timing: The vote starts at the beginning of the next round after extraction, not during the chaos of the extraction itself.
  • RTV Lockdown: Disables the sm_rtv command during the auto-vote process to prevent interference.
  • Early Completion: The confirm vote ends immediately once all players have voted or all voters have disconnected, no need to wait for the timer.
  • Disconnect Handling: Properly adjusts vote counts when players disconnect mid-vote and ends the vote early if everyone has voted.
  • Independent Poll Stages: The MapChooser vote poll uses separate timeouts for the "waiting for vote start" and "waiting for vote end" phases, preventing the first phase from cutting into the second phase's timeout.
  • Configurable Vote Threshold: The fraction of yes votes needed to pass the confirm vote is adjustable via ConVar.
  • Instructor Hint: Displays a prominent in-game hint with a pulsing icon when the vote starts, lasting the full vote duration for consistent visibility (configurable).
  • Vote Sound: Plays a notification sound when the vote starts (configurable).
  • Customizable Prefix: Chat prefix is configurable via ConVar. Colors are defined in translation files for full customization.
  • Multi-language Support: Includes translation files for English, Simplified Chinese, and Traditional Chinese.
  • Admin Commands: Reset vote state and check plugin status from the console.

Requirements

  • SourceMod 1.12
  • MapChooser — Required for map voting functionality.
  • MoreColors — Only required if you want to recompile the plugin from source. The compiled plugin already includes this library.

Installation

  1. Download and extract the attached archive.
  2. Drag and drop the folders from the archive directly into your server's nmrih/addons/sourcemod/ directory.
  3. Restart the map or type sm plugins load nmrih-autortv in the console.
  4. The plugin will automatically generate its default configuration file on first run.

Directory Structure

addons/sourcemod/
├── plugins/
│   └── nmrih-autortv.smx
├── scripting/
│   ├── nmrih-autortv.sp
│   └── include/
│       ├── mapchooser.inc
│       ├── morecolors.inc
│       └── nmr_instructor.inc
└── translations/
    ├── autortv.phrases.txt       (English)
    ├── chi/
    │   └── autortv.phrases.txt   (Simplified Chinese)
    └── zho/
        └── autortv.phrases.txt   (Traditional Chinese)

Configuration

The plugin generates a configuration file at:

nmrih/cfg/sourcemod/plugin.autortv.cfg

Default configuration:

// Enable/Disable auto RTV on extraction
// - Minimum: 0.000000, Maximum: 1.000000
sm_autortv_enabled "1"

// 0=Start map vote directly, 1=Require yes/no confirm vote first
// - Minimum: 0.000000, Maximum: 1.000000
sm_autortv_confirm_vote "1"

// Delay in seconds before vote after round restart
// - Minimum: 1.000000, Maximum: 60.000000
sm_autortv_change_delay "4.0"

// Fraction of yes votes needed to pass (0.01-1.0)
// - Minimum: 0.010000, Maximum: 1.000000
sm_autortv_vote_threshold "0.6"

// Chat prefix (without brackets)
sm_autortv_prefix "AutoRTV"

// Play a notification sound when vote starts
// - Minimum: 0.000000, Maximum: 1.000000
sm_autortv_vote_sound "1"

// Display instructor hint when vote starts
// - Minimum: 0.000000, Maximum: 1.000000
sm_autortv_instructor_hint "1"

Vote Flow

  1. Players successfully extract from the map.
  2. The round restarts (nmrih_round_begin fires).
  3. After the configured delay, one of the following happens:
    • Confirm vote enabled (default): A yes/no menu appears for each player with an instructor hint and notification sound. If the yes votes meet the threshold (default 60%+), a MapChooser map vote starts. If not, the map stays and RTV is re-enabled.
    • Confirm vote disabled: A MapChooser map vote starts directly.
  4. MapChooser handles the map vote and changes the map if a result is reached.

Commands

Command Description Permission
sm_autortv_reset Reset the current auto vote state ADMFLAG_CHANGEMAP
sm_autortv_status Show current plugin status ADMFLAG_GENERIC

Translations

This plugin includes translations for:

  • English
  • Simplified Chinese (chi)
  • Traditional Chinese (zho)

Credits

License

This plugin is licensed under the GNU General Public License v3.0 (GPLv3).

  • You can use, modify, and distribute this plugin as long as you follow the terms and conditions of the license.
  • A copy of the license can be found in the LICENSE file.
  • Source code modifications must be released under the same GPLv3 license.

For the full license text, see https://www.gnu.org/licenses/gpl-3.0.html.

About

No description, website, or topics provided.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages