diff --git a/src/Jail.cs b/src/Jail.cs index 58df656..dfc8eea 100644 --- a/src/Jail.cs +++ b/src/Jail.cs @@ -102,6 +102,7 @@ public class JailConfig : BasePluginConfig // main plugin file, controls central hooking // defers to warden, lr and sd +[MinimumApiVersion(128)] public class JailPlugin : BasePlugin, IPluginConfig { // workaround to query global state! diff --git a/src/SpecialDay/Dodgeball.cs b/src/SpecialDay/Dodgeball.cs index 88f4bf9..45c633e 100644 --- a/src/SpecialDay/Dodgeball.cs +++ b/src/SpecialDay/Dodgeball.cs @@ -18,7 +18,7 @@ public class SDDodgeball : SDBase public override void setup() { announce("Dodgeball started"); - announce("Please 15 seconds for damage be enabled"); + announce($"Please {delay} seconds for damage be enabled"); } public override void start() diff --git a/src/SpecialDay/FriendlyFire.cs b/src/SpecialDay/FriendlyFire.cs index e4f8df4..3d6109f 100644 --- a/src/SpecialDay/FriendlyFire.cs +++ b/src/SpecialDay/FriendlyFire.cs @@ -19,7 +19,7 @@ public class SDFriendlyFire : SDBase public override void setup() { announce("Friendly fire day started"); - announce("Please 15 seconds for friendly fire to be enabled"); + announce($"Please {delay} seconds for friendly fire to be enabled"); } public override void start() diff --git a/src/SpecialDay/Grenade.cs b/src/SpecialDay/Grenade.cs index 0f5488c..5da9347 100644 --- a/src/SpecialDay/Grenade.cs +++ b/src/SpecialDay/Grenade.cs @@ -18,7 +18,7 @@ public class SDGrenade : SDBase public override void setup() { announce("Grenade started"); - announce("Please 15 seconds for damage be enabled"); + announce($"Please {delay} seconds for damage be enabled"); } public override void start() diff --git a/src/SpecialDay/HeadshotOnly.cs b/src/SpecialDay/HeadshotOnly.cs index 2afeb1e..8ceb5b6 100644 --- a/src/SpecialDay/HeadshotOnly.cs +++ b/src/SpecialDay/HeadshotOnly.cs @@ -19,7 +19,7 @@ public class SDHeadshotOnly : SDBase public override void setup() { announce("Headshot only started"); - announce("Please 15 seconds for damage be enabled"); + announce($"Please {delay} seconds for damage be enabled"); } public override void start() diff --git a/src/SpecialDay/HideAndSeek.cs b/src/SpecialDay/HideAndSeek.cs index 19247b5..444627f 100644 --- a/src/SpecialDay/HideAndSeek.cs +++ b/src/SpecialDay/HideAndSeek.cs @@ -19,7 +19,7 @@ public class SDHideAndSeek : SDBase public override void setup() { announce("hide and seek started"); - announce("T's have 15 seconds to hide"); + announce($"T's have {delay} seconds to hide"); } public override void start() diff --git a/src/SpecialDay/Juggernaut.cs b/src/SpecialDay/Juggernaut.cs index 5708aab..bdae5ba 100644 --- a/src/SpecialDay/Juggernaut.cs +++ b/src/SpecialDay/Juggernaut.cs @@ -18,7 +18,7 @@ public class SDJuggernaut : SDBase public override void setup() { announce("Juggernaut started"); - announce("Please 15 seconds for friendly fire to be enabled"); + announce($"Please {delay} seconds for friendly fire to be enabled"); } public override void start() diff --git a/src/SpecialDay/Knife.cs b/src/SpecialDay/Knife.cs index 2c1e854..c1fdbcb 100644 --- a/src/SpecialDay/Knife.cs +++ b/src/SpecialDay/Knife.cs @@ -18,7 +18,7 @@ public class SDKnifeWarday : SDBase public override void setup() { announce("knife warday started"); - announce("Please 15 seconds for damage be enabled"); + announce($"Please {delay} seconds for damage be enabled"); } public override void start() diff --git a/src/SpecialDay/SDBase.cs b/src/SpecialDay/SDBase.cs index 51c343c..6abc973 100644 --- a/src/SpecialDay/SDBase.cs +++ b/src/SpecialDay/SDBase.cs @@ -162,4 +162,6 @@ public void announce(String str) public bool restrict_damage = false; public String weapon_restrict = ""; public SDState state = SDState.INACTIVE; + + public int delay = 15; } \ No newline at end of file diff --git a/src/SpecialDay/ScoutKnife.cs b/src/SpecialDay/ScoutKnife.cs index ae8aa0c..8ebaad0 100644 --- a/src/SpecialDay/ScoutKnife.cs +++ b/src/SpecialDay/ScoutKnife.cs @@ -19,7 +19,7 @@ public class SDScoutKnife : SDBase public override void setup() { announce("Scout knife started"); - announce("Please 15 seconds for damage be enabled"); + announce($"Please {delay} seconds for damage be enabled"); } public override void start() diff --git a/src/SpecialDay/SpecialDay.cs b/src/SpecialDay/SpecialDay.cs index 9bd2d25..6a18928 100644 --- a/src/SpecialDay/SpecialDay.cs +++ b/src/SpecialDay/SpecialDay.cs @@ -159,13 +159,15 @@ public void setup_sd(CCSPlayerController? invoke, ChatMenuOption option) if(active_sd != null) { JailPlugin.start_event(); + + active_sd.delay = delay; active_sd.setup_common(); } // start the countdown for enable if(JailPlugin.global_ctx != null) { - countdown.start($"{name} specialday",15,0,null,start_sd); + countdown.start($"{name} specialday",delay,0,null,start_sd); } team_save.save(); @@ -269,14 +271,22 @@ public void cancel_sd_cmd(CCSPlayerController? player,CommandInfo command) end_sd(true); } - public void sd_cmd_internal(CCSPlayerController? player) + public void sd_cmd_internal(CCSPlayerController? player,CommandInfo command) { if(player == null || !player.is_valid()) { return; } - var sd_menu = new ChatMenu("SD Menu"); + delay = 15; + + if(Int32.TryParse(command.ArgByIndex(1),out int delay_opt)) + { + delay = delay_opt; + } + + + ChatMenu sd_menu = new ChatMenu("Specialday"); // Build the basic LR menu for(int s = 0; s < SD_NAME.Length - 1; s++) @@ -308,7 +318,7 @@ public void sd_cmd(CCSPlayerController? player,CommandInfo command) { override_ff = false; - sd_cmd_internal(player); + sd_cmd_internal(player,command); } [RequiresPermissions("@css/generic")] @@ -316,7 +326,7 @@ public void sd_ff_cmd(CCSPlayerController? player,CommandInfo command) { override_ff = true; - sd_cmd_internal(player); + sd_cmd_internal(player,command); } public enum SDType @@ -350,6 +360,8 @@ public enum SDType "None" }; + int delay = 15; + SDBase? active_sd = null; bool override_ff = false; diff --git a/src/SpecialDay/Spectre.cs b/src/SpecialDay/Spectre.cs index 2437ce4..92ebc49 100644 --- a/src/SpecialDay/Spectre.cs +++ b/src/SpecialDay/Spectre.cs @@ -18,7 +18,7 @@ public class SDSpectre : SDBase public override void setup() { announce("spectre started"); - announce("Please 15 seconds for damage be enabled"); + announce($"Please {delay} seconds for damage be enabled"); } public override void make_boss(CCSPlayerController? spectre, int count) diff --git a/src/SpecialDay/Tank.cs b/src/SpecialDay/Tank.cs index ab67a8a..6f9e730 100644 --- a/src/SpecialDay/Tank.cs +++ b/src/SpecialDay/Tank.cs @@ -18,7 +18,7 @@ public class SDTank : SDBase public override void setup() { announce("tank day started"); - announce("Please 15 seconds for damage be enabled"); + announce($"Please {delay} seconds for damage be enabled"); } public override void make_boss(CCSPlayerController? tank, int count) diff --git a/src/Warden/Warden.cs b/src/Warden/Warden.cs index 961b828..1711d73 100644 --- a/src/Warden/Warden.cs +++ b/src/Warden/Warden.cs @@ -281,10 +281,15 @@ void round_timer_callback() start_timer = null; } - public void round_start() + void setup_cvar() { Server.ExecuteCommand("mp_force_pick_time 3000"); + Server.ExecuteCommand("mp_autoteambalance 0"); + + } + public void round_start() + { purge_round(); if(JailPlugin.global_ctx != null) @@ -436,12 +441,14 @@ public bool join_team(CCSPlayerController? invoke, CommandInfo command) { if(invoke == null || !invoke.is_valid()) { - return true; + invoke.play_sound("sounds/ui/counter_beep.vsnd"); + return false; } - if(command.ArgCount != 3) + if(command.ArgCount < 2) { - return true; + invoke.play_sound("sounds/ui/counter_beep.vsnd"); + return false; } CCSPlayerPawn? pawn = invoke.pawn(); @@ -449,14 +456,7 @@ public bool join_team(CCSPlayerController? invoke, CommandInfo command) if(!Int32.TryParse(command.ArgByIndex(1),out int team)) { - return true; - } - - - JailPlayer? jail_player = jail_player_from_player(invoke); - - if(jail_player == null) - { + invoke.play_sound("sounds/ui/counter_beep.vsnd"); return false; }