diff --git a/src/LastRequest/Rebel.cs b/src/LastRequest/Rebel.cs index c2b5541..b16cba8 100644 --- a/src/LastRequest/Rebel.cs +++ b/src/LastRequest/Rebel.cs @@ -38,12 +38,7 @@ public void RebelGuns(CCSPlayerController player, ChatMenuOption option) return; } - player.StripWeapons(); - - player.GiveMenuWeapon(option.Text); - player.GiveWeapon("deagle"); - - player.GiveArmour(); + Weapon.GunMenuGive(player,option); player.SetHealth(Lib.AliveCtCount() * 100); diff --git a/src/Lib/Weapon.cs b/src/Lib/Weapon.cs index 3d52869..f55b79d 100644 --- a/src/Lib/Weapon.cs +++ b/src/Lib/Weapon.cs @@ -94,8 +94,17 @@ static public void SetAmmo(this CBasePlayerWeapon? weapon, int clip, int reserve } } - // TODO: for now this is just a give guns - // because menus dont work + public static void EventGunMenuCallback(CCSPlayerController player, ChatMenuOption option) + { + // Event has been cancelled in the mean time dont give any guns + if(!JailPlugin.EventActive()) + { + return; + } + + GunMenuGive(player,option); + } + static public void EventGunMenu(this CCSPlayerController? player) { // Event has been cancelled in the mean time dont give any guns @@ -104,30 +113,38 @@ static public void EventGunMenu(this CCSPlayerController? player) return; } - player.GunMenu(false); + player.GunMenuInternal(false,EventGunMenuCallback); } - static void GiveMenuWeaponCallback(this CCSPlayerController player, ChatMenuOption option) + public static void GunMenuGive(this CCSPlayerController player, ChatMenuOption option) { - if(!player.IsLegal()) + if(!player.IsLegalAlive()) { return; } - // strip guns so the new ones don't just drop to the ground player.StripWeapons(); - // give their desired guns with lots of reserve ammo - player.GiveNamedItem(GunGiveName(option.Text)); + player.GiveMenuWeapon(option.Text); player.GiveWeapon("deagle"); + player.GiveArmour(); + CBasePlayerWeapon? primary = player.FindWeapon(GUN_LIST[option.Text]); primary.SetAmmo(-1,999); CBasePlayerWeapon? secondary = player.FindWeapon("deagle"); secondary.SetAmmo(-1,999); - - player.GiveArmour(); + } + + static void GiveMenuWeaponCallback(this CCSPlayerController player, ChatMenuOption option) + { + if(!player.IsLegal()) + { + return; + } + + GunMenuGive(player,option); } static Dictionary GUN_LIST = new Dictionary()