From 1804c5abe2c12dd440639ab35af985a784b2ae16 Mon Sep 17 00:00:00 2001 From: imi-tat0r Date: Sat, 9 Mar 2024 16:21:07 +0100 Subject: [PATCH] Added FakeConVars Added CS2-CustomVotes support --- CS2-Essentials/CS2-Essentials.csproj | 8 ++- CS2-Essentials/Features/FriendlyFire.cs | 35 ++++++++++++- CS2-Essentials/Features/RageQuit.cs | 9 +++- CS2-Essentials/Features/RapidFireFix.cs | 50 +++++++++++++++++- CS2-Essentials/Features/ResetScore.cs | 8 ++- CS2-Essentials/Features/TeleportFix.cs | 29 ++++++++++ CS2-Essentials/Features/WeaponRestrict.cs | 9 ++++ CS2-Essentials/Plugin.cs | 64 +++++++++++++++-------- CS2-Essentials/PluginConfig.cs | 31 +++++++++++ README.MD | 34 ++++++++++-- 10 files changed, 244 insertions(+), 33 deletions(-) create mode 100644 CS2-Essentials/PluginConfig.cs diff --git a/CS2-Essentials/CS2-Essentials.csproj b/CS2-Essentials/CS2-Essentials.csproj index 515604a..01f2814 100644 --- a/CS2-Essentials/CS2-Essentials.csproj +++ b/CS2-Essentials/CS2-Essentials.csproj @@ -9,7 +9,13 @@ - + + + + + + ..\..\CS2-CustomVotes\CS2-CustomVotes.Shared\bin\Release\net7.0\CS2-CustomVotes.Shared.dll + diff --git a/CS2-Essentials/Features/FriendlyFire.cs b/CS2-Essentials/Features/FriendlyFire.cs index ea56291..aee28c2 100644 --- a/CS2-Essentials/Features/FriendlyFire.cs +++ b/CS2-Essentials/Features/FriendlyFire.cs @@ -1,15 +1,21 @@ -using CounterStrikeSharp.API.Core; +using CounterStrikeSharp.API; +using CounterStrikeSharp.API.Core; +using CounterStrikeSharp.API.Modules.Cvars; using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; +using CS2_CustomVotes.Shared.Models; namespace hvhgg_essentials.Features; public class FriendlyFire { private readonly Plugin _plugin; + public static readonly FakeConVar hvh_unmatched_friendlyfire = new("hvh_unmatched_friendlyfire", "Enables unmatched.gg style friendly fire (utility only)", true, ConVarFlags.FCVAR_REPLICATED); public FriendlyFire(Plugin plugin) { _plugin = plugin; + _plugin.RegisterFakeConVars(this); + hvh_unmatched_friendlyfire.Value = _plugin.Config.UnmatchedFriendlyFire; } private static readonly string[] AllowedDamageInflicter = @@ -17,6 +23,33 @@ public FriendlyFire(Plugin plugin) "inferno", "hegrenade_projectile", "flashbang_projectile", "smokegrenade_projectile", "decoy_projectile", "planted_c4" }; + + public static void RegisterCustomVotes(Plugin plugin) + { + if (!plugin.Config.CustomVoteSettings.FriendlyFireVote) + return; + + var defaultOption = plugin.Config.UnmatchedFriendlyFire ? "Enable" : "Disable"; + + Plugin.CustomVotesApi.Get()?.AddCustomVote( + "friendlyfire", + new List { + "ff" + }, + "unmatched.gg friendly fire", + defaultOption, + 30, + new Dictionary + { + { "Enable", new("{Green}Enable", new List { "hvh_unmatched_friendlyfire 0" })}, + { "Disable", new("{Red}Disable", new List { "hvh_unmatched_friendlyfire 1" })}, + }, + plugin.Config.CustomVoteSettings.Style); + } + public static void UnregisterCustomVotes(Plugin plugin) + { + Plugin.CustomVotesApi.Get()?.RemoveCustomVote("friendlyfire"); + } public HookResult OnTakeDamage(DynamicHook hook) { diff --git a/CS2-Essentials/Features/RageQuit.cs b/CS2-Essentials/Features/RageQuit.cs index 35ac6a6..5720ebe 100644 --- a/CS2-Essentials/Features/RageQuit.cs +++ b/CS2-Essentials/Features/RageQuit.cs @@ -2,6 +2,8 @@ using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Modules.Commands; +using CounterStrikeSharp.API.Modules.Cvars; +using CounterStrikeSharp.API.Modules.Cvars.Validators; using CounterStrikeSharp.API.Modules.Utils; namespace hvhgg_essentials.Features; @@ -9,14 +11,17 @@ namespace hvhgg_essentials.Features; public class RageQuit { private readonly Plugin _plugin; + public static readonly FakeConVar hvh_ragequit = new("hvh_ragequit", "Enables the rage quit feature", true, ConVarFlags.FCVAR_REPLICATED); public RageQuit(Plugin plugin) { _plugin = plugin; + _plugin.RegisterFakeConVars(this); + hvh_ragequit.Value = _plugin.Config.AllowRageQuit; } - [ConsoleCommand("rq", "Rage quit")] - [ConsoleCommand("ragequit", "Rage quit")] + [ConsoleCommand("css_rq", "Rage quit")] + [ConsoleCommand("css_ragequit", "Rage quit")] public void OnRageQuit(CCSPlayerController? player, CommandInfo inf) { if (!_plugin.Config.AllowRageQuit) diff --git a/CS2-Essentials/Features/RapidFireFix.cs b/CS2-Essentials/Features/RapidFireFix.cs index 282e31a..45cff47 100644 --- a/CS2-Essentials/Features/RapidFireFix.cs +++ b/CS2-Essentials/Features/RapidFireFix.cs @@ -1,7 +1,10 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; +using CounterStrikeSharp.API.Modules.Cvars; +using CounterStrikeSharp.API.Modules.Cvars.Validators; using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; using CounterStrikeSharp.API.Modules.Utils; +using CS2_CustomVotes.Shared.Models; using hvhgg_essentials.Enums; namespace hvhgg_essentials.Features; @@ -13,10 +16,56 @@ public class RapidFire private readonly Dictionary _rapidFireBlockWarnings = new(); private readonly Plugin _plugin; + public static readonly FakeConVar hvh_restrict_rapidfire = new("hvh_restrict_rapidfire", "Restrict rapid fire", 0, ConVarFlags.FCVAR_REPLICATED, new RangeValidator(0, 3)); + public static readonly FakeConVar hvh_rapidfire_reflect_scale = new("hvh_rapidfire_reflect_scale", "Reflect scale", 1, ConVarFlags.FCVAR_REPLICATED, new RangeValidator(0, 1)); public RapidFire(Plugin plugin) { _plugin = plugin; + _plugin.RegisterFakeConVars(this); + hvh_restrict_rapidfire.Value = (int) _plugin.Config.RapidFireFixMethod; + hvh_rapidfire_reflect_scale.Value = _plugin.Config.RapidFireReflectScale; + } + + public static void RegisterCustomVotes(Plugin plugin) + { + var defaultOption = plugin.Config.RapidFireFixMethod switch + { + FixMethod.Allow => "Allow", + FixMethod.Ignore => "Block", + FixMethod.Reflect => "Reflect", + FixMethod.ReflectSafe => "Reflect (safe)", + _ => "Allow" + }; + + var options = new Dictionary(); + + if (plugin.Config.CustomVoteSettings.RapidFireVote != "off") + { + options.Add("Allow", new VoteOption("{Green}Allow", new List { "hvh_restrict_rapidfire 0" })); + options.Add("Block", new VoteOption("{Red}Block", new List { "hvh_restrict_rapidfire 1" })); + + if (plugin.Config.CustomVoteSettings.RapidFireVote == "full") + { + options.Add("Reflect", new VoteOption("{Orange}Reflect", new List { "hvh_restrict_rapidfire 2" })); + options.Add("Reflect (safe)", new VoteOption("{Orange}Reflect (safe)", new List { "hvh_restrict_rapidfire 3" })); + } + } + + Plugin.CustomVotesApi.Get()?.AddCustomVote( + "rapidfire", + new List { + "rf" + }, + "Rapid fire", + defaultOption, + 30, + options, + plugin.Config.CustomVoteSettings.Style); + } + public static void UnregisterCustomVotes(Plugin plugin) + { + Plugin.CustomVotesApi.Get()?.RemoveCustomVote("rapidfire"); } public HookResult OnWeaponFire(EventWeaponFire eventWeaponFire, GameEventInfo info) @@ -27,7 +76,6 @@ public HookResult OnWeaponFire(EventWeaponFire eventWeaponFire, GameEventInfo in var firedWeapon = eventWeaponFire.Userid.Pawn.Value?.WeaponServices?.ActiveWeapon.Value; var weaponData = firedWeapon?.GetVData(); - var nextPrimaryAttackTick = firedWeapon?.NextPrimaryAttackTick ?? 0; var index = eventWeaponFire.Userid.Pawn.Index; if (!_lastPlayerShotTick.TryGetValue(index, out var lastShotTick)) diff --git a/CS2-Essentials/Features/ResetScore.cs b/CS2-Essentials/Features/ResetScore.cs index 249543a..15ed410 100644 --- a/CS2-Essentials/Features/ResetScore.cs +++ b/CS2-Essentials/Features/ResetScore.cs @@ -2,6 +2,7 @@ using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; using CounterStrikeSharp.API.Modules.Commands; +using CounterStrikeSharp.API.Modules.Cvars; using CounterStrikeSharp.API.Modules.Utils; namespace hvhgg_essentials.Features; @@ -9,14 +10,17 @@ namespace hvhgg_essentials.Features; public class ResetScore { private readonly Plugin _plugin; + public static readonly FakeConVar hvh_resetscore = new("hvh_resetscore", "Enables the reset score feature", true, ConVarFlags.FCVAR_REPLICATED); public ResetScore(Plugin plugin) { _plugin = plugin; + _plugin.RegisterFakeConVars(this); + hvh_resetscore.Value = _plugin.Config.AllowResetScore; } - [ConsoleCommand("rs", "Reset score")] - [ConsoleCommand("resetscore", "Reset score")] + [ConsoleCommand("css_rs", "Reset score")] + [ConsoleCommand("css_resetscore", "Reset score")] public void OnResetScore(CCSPlayerController? player, CommandInfo inf) { if (!_plugin.Config.AllowResetScore) diff --git a/CS2-Essentials/Features/TeleportFix.cs b/CS2-Essentials/Features/TeleportFix.cs index b6dc9a0..4069a43 100644 --- a/CS2-Essentials/Features/TeleportFix.cs +++ b/CS2-Essentials/Features/TeleportFix.cs @@ -1,8 +1,10 @@ using System.Runtime.CompilerServices; using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; +using CounterStrikeSharp.API.Modules.Cvars; using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; using CounterStrikeSharp.API.Modules.Utils; +using CS2_CustomVotes.Shared.Models; using hvhgg_essentials.Extensions; using Microsoft.Extensions.DependencyInjection; @@ -12,10 +14,37 @@ public class TeleportFix { private readonly Plugin _plugin; private readonly Dictionary _teleportBlockWarnings = new(); + public static readonly FakeConVar hvh_restrict_teleport = new("hvh_restrict_teleport", "Restricts players from teleporting/airstucking and crashing the server", true, ConVarFlags.FCVAR_REPLICATED); public TeleportFix(Plugin plugin) { _plugin = plugin; + _plugin.RegisterFakeConVars(this); + hvh_restrict_teleport.Value = _plugin.Config.RestrictTeleport; + } + + public static void RegisterCustomVotes(Plugin plugin) + { + if (!plugin.Config.CustomVoteSettings.TeleportFixVote) + return; + + var defaultOption = plugin.Config.RestrictTeleport ? "Block" : "Allow"; + + Plugin.CustomVotesApi.Get()?.AddCustomVote( + "teleport", + "Teleport/Airstuck", + defaultOption, + 30, + new Dictionary + { + { "Allow", new("{Green}Allow", new List { "hvh_restrict_teleport 0" })}, + { "Block", new("{Red}Block", new List { "hvh_restrict_teleport 1" })}, + }, + plugin.Config.CustomVoteSettings.Style); + } + public static void UnregisterCustomVotes(Plugin plugin) + { + Plugin.CustomVotesApi.Get()?.RemoveCustomVote("teleport"); } public HookResult RunCommand(DynamicHook h) diff --git a/CS2-Essentials/Features/WeaponRestrict.cs b/CS2-Essentials/Features/WeaponRestrict.cs index 8016cec..a0bd7b7 100644 --- a/CS2-Essentials/Features/WeaponRestrict.cs +++ b/CS2-Essentials/Features/WeaponRestrict.cs @@ -1,5 +1,7 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; +using CounterStrikeSharp.API.Modules.Cvars; +using CounterStrikeSharp.API.Modules.Cvars.Validators; using CounterStrikeSharp.API.Modules.Entities.Constants; using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; using CounterStrikeSharp.API.Modules.Utils; @@ -17,10 +19,17 @@ public class WeaponRestrict { "weapon_g3sg1", new Tuple(ItemDefinition.G3SG1, 5000) }, }; private readonly Dictionary _lastWeaponRestrictPrint = new(); + public static readonly FakeConVar hvh_restrict_awp = new("hvh_restrict_awp", "Restrict awp to X per team", -1, ConVarFlags.FCVAR_REPLICATED, new RangeValidator(-1, int.MaxValue)); + public static readonly FakeConVar hvh_restrict_scout = new("hvh_restrict_scout", "Restrict scout to X per team", -1, ConVarFlags.FCVAR_REPLICATED, new RangeValidator(-1, int.MaxValue)); + public static readonly FakeConVar hvh_restrict_auto = new("hvh_restrict_auto", "Restrict autosniper to X per team", -1, ConVarFlags.FCVAR_REPLICATED, new RangeValidator(-1, int.MaxValue)); public WeaponRestrict(Plugin plugin) { _plugin = plugin; + _plugin.RegisterFakeConVars(this); + hvh_restrict_awp.Value = _plugin.Config.AllowedAwpCount; + hvh_restrict_scout.Value = _plugin.Config.AllowedScoutCount; + hvh_restrict_auto.Value = _plugin.Config.AllowedAutoSniperCount; } public HookResult OnWeaponCanUse(DynamicHook hook) diff --git a/CS2-Essentials/Plugin.cs b/CS2-Essentials/Plugin.cs index 1115015..a8f4baf 100644 --- a/CS2-Essentials/Plugin.cs +++ b/CS2-Essentials/Plugin.cs @@ -4,10 +4,14 @@ using CounterStrikeSharp.API; using CounterStrikeSharp.API.Core; using CounterStrikeSharp.API.Core.Attributes.Registration; +using CounterStrikeSharp.API.Core.Capabilities; using CounterStrikeSharp.API.Modules.Admin; using CounterStrikeSharp.API.Modules.Commands; +using CounterStrikeSharp.API.Modules.Cvars; +using CounterStrikeSharp.API.Modules.Cvars.Validators; using CounterStrikeSharp.API.Modules.Memory; using CounterStrikeSharp.API.Modules.Memory.DynamicFunctions; +using CS2_CustomVotes.Shared; using hvhgg_essentials.Enums; using hvhgg_essentials.Features; using Microsoft.Extensions.DependencyInjection; @@ -15,27 +19,10 @@ namespace hvhgg_essentials; -public partial class Cs2EssentialsConfig : BasePluginConfig -{ - [JsonPropertyName("RapidFireFixMethod")] public FixMethod RapidFireFixMethod { get; set; } = FixMethod.Ignore; - [JsonPropertyName("RapidFireReflectScale")] public float RapidFireReflectScale { get; set; } = 1f; - [JsonPropertyName("AllowedAwpCount")] public int AllowedAwpCount { get; set; } = -1; - [JsonPropertyName("AllowedScoutCount")] public int AllowedScoutCount { get; set; } = -1; - [JsonPropertyName("AllowedAutoSniperCount")] public int AllowedAutoSniperCount { get; set; } = -1; - [JsonPropertyName("UnmatchedFriendlyFire")] public bool UnmatchedFriendlyFire { get; set; } = true; - [JsonPropertyName("RestrictTeleport")] public bool RestrictTeleport { get; set; } = true; - [JsonPropertyName("AllowAdPrint")] public bool AllowAdPrint { get; set; } = true; - [JsonPropertyName("AllowSettingsPrint")] public bool AllowSettingsPrint { get; set; } = true; - [JsonPropertyName("AllowResetScore")] public bool AllowResetScore { get; set; } = true; - [JsonPropertyName("AllowRageQuit")] public bool AllowRageQuit { get; set; } = true; - [JsonPropertyName("ChatPrefix")] public string ChatPrefix { get; set; } = "[{Red}Hv{DarkRed}H{Default}.gg]"; - [JsonPropertyName("ConfigVersion")] public override int Version { get; set; } = 3; -} - public class Plugin : BasePlugin, IPluginConfig { public override string ModuleName => "HvH.gg - Essentials"; - public override string ModuleVersion => "1.1.3"; + public override string ModuleVersion => "1.2.0"; public override string ModuleAuthor => "imi-tat0r"; public override string ModuleDescription => "Essential features for CS2 HvH servers"; public Cs2EssentialsConfig Config { get; set; } = new(); @@ -47,6 +34,9 @@ public class Plugin : BasePlugin, IPluginConfig public required MemoryFunctionVoid RunCommand; + public static PluginCapability CustomVotesApi { get; } = new("custom_votes:api"); + private bool _isCustomVotesLoaded = false; + public void OnConfigParsed(Cs2EssentialsConfig config) { Config = config; @@ -102,10 +92,32 @@ public override void Load(bool hotReload) UseResetScore(); UseMisc(); UseTeleport(); - + Console.WriteLine("[HvH.gg] Finished loading HvH.gg Essentials plugin"); } - + + public override void OnAllPluginsLoaded(bool hotReload) + { + base.OnAllPluginsLoaded(hotReload); + + try + { + if (CustomVotesApi.Get() is null) + return; + } + catch (Exception e) + { + Console.WriteLine($"[HvH.gg] CS2-CustomVotes plugin not found. Custom votes will not be registered."); + return; + } + + _isCustomVotesLoaded = true; + Console.WriteLine("[HvH.gg] Registering custom votes"); + RapidFire.RegisterCustomVotes(this); + FriendlyFire.RegisterCustomVotes(this); + TeleportFix.RegisterCustomVotes(this); + } + private void UseTeleport() { var teleportFix = _serviceProvider!.GetRequiredService(); @@ -198,8 +210,6 @@ public void OnReloadConfigCommand(CCSPlayerController? player, CommandInfo info) public override void Unload(bool hotReload) { - base.Unload(hotReload); - if (_serviceProvider is null) return; @@ -216,5 +226,15 @@ public override void Unload(bool hotReload) var teleportFix = _serviceProvider.GetRequiredService(); RunCommand.Unhook(teleportFix.RunCommand, HookMode.Pre); + if (!_isCustomVotesLoaded) + return; + + Console.WriteLine("[HvH.gg] Unregistering custom votes"); + + RapidFire.UnregisterCustomVotes(this); + FriendlyFire.UnregisterCustomVotes(this); + TeleportFix.UnregisterCustomVotes(this); + + base.Unload(hotReload); } } \ No newline at end of file diff --git a/CS2-Essentials/PluginConfig.cs b/CS2-Essentials/PluginConfig.cs new file mode 100644 index 0000000..ccadc00 --- /dev/null +++ b/CS2-Essentials/PluginConfig.cs @@ -0,0 +1,31 @@ +using System.Text.Json.Serialization; +using CounterStrikeSharp.API.Core; +using hvhgg_essentials.Enums; + +namespace hvhgg_essentials; + +public class Cs2CustomVoteSettings +{ + [JsonPropertyName("FriendlyFireVote")] public bool FriendlyFireVote { get; set; } = false; + [JsonPropertyName("TeleportFixVote")] public bool TeleportFixVote { get; set; } = false; + [JsonPropertyName("RapidFireVote")] public string RapidFireVote { get; set; } = "full"; + [JsonPropertyName("Style")] public string Style { get; set; } = "center"; +} + +public partial class Cs2EssentialsConfig : BasePluginConfig +{ + [JsonPropertyName("RapidFireFixMethod")] public FixMethod RapidFireFixMethod { get; set; } = FixMethod.Ignore; + [JsonPropertyName("RapidFireReflectScale")] public float RapidFireReflectScale { get; set; } = 1f; + [JsonPropertyName("AllowedAwpCount")] public int AllowedAwpCount { get; set; } = -1; + [JsonPropertyName("AllowedScoutCount")] public int AllowedScoutCount { get; set; } = -1; + [JsonPropertyName("AllowedAutoSniperCount")] public int AllowedAutoSniperCount { get; set; } = -1; + [JsonPropertyName("UnmatchedFriendlyFire")] public bool UnmatchedFriendlyFire { get; set; } = true; + [JsonPropertyName("RestrictTeleport")] public bool RestrictTeleport { get; set; } = true; + [JsonPropertyName("AllowAdPrint")] public bool AllowAdPrint { get; set; } = true; + [JsonPropertyName("AllowSettingsPrint")] public bool AllowSettingsPrint { get; set; } = true; + [JsonPropertyName("AllowResetScore")] public bool AllowResetScore { get; set; } = true; + [JsonPropertyName("AllowRageQuit")] public bool AllowRageQuit { get; set; } = true; + [JsonPropertyName("ChatPrefix")] public string ChatPrefix { get; set; } = "[{Red}Hv{DarkRed}H{Default}.gg]"; + [JsonPropertyName("CustomVoteSettings")] public Cs2CustomVoteSettings CustomVoteSettings { get; set; } = new(); + [JsonPropertyName("ConfigVersion")] public override int Version { get; set; } = 4; +} \ No newline at end of file diff --git a/README.MD b/README.MD index 5a43a7c..f478b08 100644 --- a/README.MD +++ b/README.MD @@ -1,11 +1,12 @@ ![Copyright ev0lve Digital](https://img.shields.io/badge/Copyright-ev0lve%20Digital-blue) ![GitHub License](https://img.shields.io/github/license/HvH-gg/CS2-Essentials) ![Issues](https://img.shields.io/github/issues/HvH-gg/CS2-Essentials) ![Downloads](https://img.shields.io/github/downloads/HvH-gg/CS2-Essentials/total) ![Stars](https://img.shields.io/github/stars/HvH-gg/CS2-Essentials) -# HvH.gg CS2 Essentials (1.1.3) +# HvH.gg CS2 Essentials (1.2.0) ### If you use this plugin, you do NOT need [RapidFireFix](https://github.com/HvH-gg/RapidFireFix) anymore. Our CS2 Essentials plugin is the only plugin you need to run a successful HvH server. It includes basic features like **reset score** and **rage quit** as well as optional restrictions for **weapons**, **friendly fire**, **rapid fire** and other exploit/crash fixes. # Features +- Custom Vote support (requires [CS2-CustomVotes](https://github.com/imi-tat0r/CS2-CustomVotes)) - Reset score `!rs` - Rage quit `!rq` - Restrict weapons (awp, scout, autosniper) @@ -15,7 +16,7 @@ Our CS2 Essentials plugin is the only plugin you need to run a successful HvH se # Requirements - [Metamod:Source](https://www.sourcemm.net/downloads.php/?branch=stable) -- [CounterStrikeSharp(v167)](https://github.com/roflmuffin/CounterStrikeSharp/releases) +- [CounterStrikeSharp(v191)](https://github.com/roflmuffin/CounterStrikeSharp/releases) # Install 1. Install Metamod:Source and CounterStrikeSharp @@ -39,14 +40,39 @@ Our CS2 Essentials plugin is the only plugin you need to run a successful HvH se "AllowSettingsPrint": true, // if true, players will see an overview of the server settings with `!settings` and on spawn "AllowResetScore": true, // if true, players will be able to reset their score with `!rs` "AllowRageQuit": true, // if true, players will be able to rage quit with `!rq` - "ChatPrefix": "[{Red}Hv{DarkRed}H{Default}.gg]" // chat prefix for plugin messages - "ConfigVersion": 3 // do not change + "ChatPrefix": "[{Red}Hv{DarkRed}H{Default}.gg]", // chat prefix for plugin messages + "CustomVoteSettings": { // settings for custom votes (requires CS2-CustomVotes) + "FriendlyFireVote": false, // if true, players will be able to vote for friendly fire settings + "TeleportFixVote": false, // if true, players will be able to vote for the teleport fix settings + "RapidFireVote": "full", // You can set the style (`off`, `simple`, `full`) for the rapid fire vote + "Style":"center" // You can set the style (`center` or `chat`) for the vote menu (might be overridden by CS2-CustomVotes settings) + }, + "ConfigVersion": 4 // do not change } ``` +# ConVars +Instead of editing the config file, you can also use the following ConVars to change certain settings **on the fly**. These changes will **NOT** be saved to the config file and will be reset after a server restart. +- `hvh_restrict_rapidfire` 0 allows rapid fire, 1 blocks rapid fire, 2 reflects damage scaled, 3 reflects damage but keeps the player alive +- `hvh_rapidfire_reflect_scale` damage reflect percentage, 0.0 - 1.0 +- `hvh_restrict_teleport` if true, the teleport and airstuck exploit will be restricted. This will also prevent the server crash exploit +- `hvh_restrict_awp` how many awps are allowed per team, 0 for none, -1 for unlimited +- `hvh_restrict_scout` how many scouts are allowed per team, 0 for none, -1 for unlimited +- `hvh_restrict_auto` how many auto snipers are allowed per team, 0 for none, -1 for unlimited +- `hvh_unmatched_friendlyfire` if true, only utility damage will be dealt to teammates +- `hvh_resetscore 0/1` if true, players will be able to reset their score with `!rs` +- `hvh_ragequit 0/1` if true, players will be able to rage quit with `!rq` + # ChatPrefix Colors You can use all available colors from CounterStrikeSharp in the chat prefix. +# Custom Votes +If you have [CS2-CustomVotes](https://github.com/imi-tat0r/CS2-CustomVotes) installed, you can use the following custom votes: +- `!rapidfire` You can set the style (`off`, `simple`, `full`) in the config via `CustomVoteSettings.RapidFireVote` +- `!friendlyfire` You can enable this in the config via `CustomVoteSettings.FriendlyFireVote` +- `!teleport` You can enable this in the config via `CustomVoteSettings.TeleportVote` +> **Warning:** Teleport restriction is needed to prevent the server crash exploit. If you enable this vote, the server will be vulnerable to the crash exploit. + # Credits - [Metamod:Source](https://www.sourcemm.net/) - [CounterStrikeSharp](https://github.com/roflmuffin/CounterStrikeSharp)