Giter Club home page Giter Club logo

map-cycle's Introduction

MapCycle Plugin for CounterStrikeSharp

Overview

MapCycle is a plugin designed for CounterStrikeSharp. This plugin enables server administrators to automate the rotation of a predefined list of maps. It's compatible with both standard and workshop maps.

Donate

I dedicate a significant part of my free time to coding and developing meaningful plugins for CS2. If you appreciate my work and would like to support me, please consider making a donation through PayPal. Your support helps me continue coding CS2 plugins. Thank you! PayPal

Features

  • Automatic Map Rotation: Rotates maps according to a configurable list (random order possible).
  • Support for Multiple Map Types: Compatible with both standard and workshop maps.
  • Simple Configuration: Uses a JSON file for easy setup.
  • Chat Notifications: Informs players about the upcoming map.
  • Rtv commands: Triggers a vote directly by players or changes the map. This can depend on the configured options, such as ratio or not.
  • Config hotreloading: Allows changing options without rebooting the server.
  • Add and remove map from the cycle directly in game: Allows adding/removing maps on the fly without restarting the server.

Compatibility

Commands

Admins

  1. !addmap cs_assault Assault 3070594412: This command allows you to add a new map to the cycle without having to manually edit the configuration file.
    • Pattern: !addmap mapname display_name workshopid_or_mapname_for_offi_map
    • E.g WS map: !addmap cs_assault Assault 3070594412
    • E.g official map: !addmap de_dust2 "Dust 2" de_dust2

  1. !removemap cs_assault: This command allows you to remove a map from the cycle directly in-game or from the console, eliminating the need to manually edit the configuration file.
    • Pattern: !removemap mapname
    • E.g WS map: !removemap cs_assault
    • E.g official map: !removemap de_dust2

  1. !keepmap Assault: This command allows you to add the current map to the cycle.

    • Pattern: !keepmap [optional]mapDisplayName

    It automatically detects if it's a workshop map or not.

    How to use it:

    • For a workshop map (!goto 123123123): You can type the map ID directly with the goto command, even if it's not in the cycle. Once you're on the map, if you enjoy it, you can type !keepmap or !keepmap NoobMap with the display name or not. By default, the display name will be the map name.
    • For an official map (!goto de_inferno): You can type the map name directly with the goto command, even if it's not in the cycle. Once you're on the map, if you enjoy it, you can type !keepmap or !keepmap Inferno with the display name or not. By default, the display name will be the map name.

  1. !goto cs_assault: This command allows direct access to a chosen map (de_dust2 in this case) in your cycle, bypassing the need to wait for the current match to end. You can also go to a map workshop ID using the command !goto 123123123, even if it's not in the cycle.

  1. !go: Use this command to immediately transition to the next map, without the need to wait for the current match to conclude.

  1. !cfgr: This command allows you to change a value in the plugin configuration without having to restart the server. When you have finished changing the values in the JSON config file, type !cfgr in the chat and the added options will take effect in the current session without the need to restart.

  1. !resetrtv: Allows you to reset the RTV. You can then start a new vote or players can use the !rtv command again even if they have already used it before.

All players

  1. !nextmap / !nextmap de_dust2: Enter !nextmap to view the next map. To select a different map, type !nextmap de_dust2 or !nextmap de_aztec. Notice that the command to set the nextmap is only allowed to admins.

  1. !rtv: Use this command to initiate a vote or to trigger a map change (depending a ratio or not).

Installation

  • Download the latest release from here.
  • Unzip the folder named MapCycle.
  • Place it in the directory: game/csgo/addons/counterstrikesharp/plugins/.
  • You can start your server with the two default maps, or add new maps to the configuration file, which will be automatically generated upon the first startup.
  • This plugins needs you to have access of the flag @css/changemap in game/csgo/addons/counterstrikesharp/configs/admins.json

Admin config

Go to game/csgo/addons/counterstrikesharp/configs/admins.json. Create the file if needed. Write the configuration like the following one.

{
  "NANOR": {
    "identity": "STEAM_0:0:123123123",
    "flags": ["@css/changemap"]
  }
}

More informations here

Configuration

The configuration file is automatically generated in game/csgo/addons/counterstrikesharp/configs/plugins/MapCycle, initially containing two default maps.

JSON attributes

  • MapCycle: An object containing parameters for map rotation.

    • RandomOrder: Enables or disables random map rotation.
  • Rtv: An object containing parameters for Rock The Vote (RTV) voting.

    • Enabled: Enables or disables RTV.
    • AutoVoteEnabled: Enables or disables automatic triggering of the vote.
    • AutoVoteTimeStartInSeconds: Triggers an auto vote after the configured time in this option. Overrides AutoVoteRoundStart and AutoVoteStartAtTheEndOfMatch. Set to 0 to disable.
    • AutoVoteRoundStart: The round number when the auto vote is triggered.
    • AutoVoteStartAtTheEndOfMatch: Enables voting at the end of the match. Overrides AutoVoteRoundStart.
    • PlayerCommandEnabled: Enables or disables the !rtv command for players.
    • PlayerCommandTriggerAVote: Triggers a vote when players type !rtv instead of changing the map directly.
    • PlayerCommandRatioEnabled: Enables the use of PlayerCommandRatio.
    • PlayerCommandRatio: From 0.0 to 1.0. This ratio triggers the action of the !rtv command only if the ratio of players who have typed !rtv is reached.
    • PlayerCommandChangeTheMapDirectlyAfterVote: Triggers the map change as soon as the vote is finished.
    • VoteMapCount: The number of maps proposed in the vote.
    • VoteDurationInSeconds: The duration of the vote in seconds.
    • VoteRatioEnabled: Enables the use of VoteRatio.
    • VoteRatio: From 0.0 to 1.0. The minimum ratio of players for the vote to be valid, otherwise a map will be chosen by the map cycle.

Each map in the configuration file includes the following attributes:

  • Name: The actual name of the map (e.g., de_dust2, de_cbble).
  • DisplayName: The name that is displayed in the chat. If this field is empty, it will display the name of the map (de_dust2, etc..).
  • Id: The workshop ID, or the map name again if it's an official map.
  • Workshop: Indicates whether the map is from the workshop (true or false).

Example Configuration

{
  "MapCycle": {
    "RandomOrder": false
  },
  "Maps": [
    {
      "Name": "de_dust2",
      "DisplayName": "Dust 2",
      "Id": "de_dust2",
      "Workshop": false
    },
    {
      "Name": "de_aztec",
      "DisplayName": "Aztec",
      "Id": "3070960099",
      "Workshop": true
    }
  ],
  "Rtv": {
    "Enabled": true,
    "AutoVoteEnabled": true,
    "AutoVoteTimeStartInSeconds": 50,
    "AutoVoteRoundStart": 1,
    "AutoVoteStartAtTheEndOfMatch": true,
    "PlayerCommandEnabled": false,
    "PlayerCommandTriggerAVote": false,
    "PlayerCommandRatioEnabled": false,
    "PlayerCommandRatio": 1,
    "PlayerCommandChangeTheMapDirectlyAfterVote": false,
    "VoteMapCount": 5,
    "VoteDurationInSeconds": 30,
    "VoteRatioEnabled": true,
    "VoteRatio": 0.5
  },
  "ConfigVersion": 2
}

Troubleshooting

If the Cycle doesn't work as expected and it restarts to the first map

  1. Check if the JSON config is correctly formated. You can use this tool to verify that: https://jsonformatter.curiousconcept.com/ If it's correctly formated then you'll have a green screen

img

If not, you'll have a red screen with explanations:

img

  1. Check if the map name is correct. Set the map on your server with host_workshop_map 123123123 and when the map has started you verify the name directly on the steam server browser. img

ConfigGen Class

  • Maps: A list of MapItem objects, with each object representing a map in the rotation cycle.

MapItem Class

  • Name: The name of the map.
  • Id: The map's unique ID, used for workshop maps.
  • Workshop: A boolean value indicating whether the map is sourced from the workshop (true) or is a standard map (false).

Usage

  1. Configure your map cycle in the provided configuration file.
  2. Install and activate the plugin on your CounterStrikeSharp server.
  3. The plugin will automatically manage map rotation, announcing the next map to players at the conclusion of each match.

Author

  • ModuleName: MapCycle
  • ModuleAuthor: NANOR
  • ModuleVersion: 1.4.1

Support

For assistance, please raise an issue on the GitHub repository of the project.


Note: It is essential to ensure that CounterStrikeSharp and all necessary dependencies are properly installed and configured on your server to guarantee the effective functioning of the MapCycle plugin.

map-cycle's People

Contributors

ronanlouarn avatar msws avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.