diff --git a/vMenu/PermissionsManager.cs b/vMenu/PermissionsManager.cs index ca6763e8..2222d0ad 100644 --- a/vMenu/PermissionsManager.cs +++ b/vMenu/PermissionsManager.cs @@ -134,6 +134,90 @@ public enum Permission WPSpawn, WPSetAllAmmo, + //Weapons Permissions + WPSniperRifle, + WPFireExtinguisher, + WPCompactGrenadeLauncher, + WPSnowball, + WPVintagePistol, + WPCombatPDW, + WPHeavySniperMk2, + WPHeavySniper, + WPSweeperShotgun, + WPMicroSMG, + WPWrench, + WPPistol, + WPPumpShotgun, + WPAPPistol, + WPBall, + WPMolotov, + WPSMG, + WPStickyBomb, + WPPetrolCan, + WPStunGun, + WPAssaultRifleMk2, + WPHeavyShotgun, + WPMinigun, + WPGolfClub, + WPFlareGun, + WPFlare, + WPGrenadeLauncherSmoke, + WPHammer, + WPCombatPistol, + WPGusenberg, + WPCompactRifle, + WPHomingLauncher, + WPNightstick, + WPRailgun, + WPSawnOffShotgun, + WPSMGMk2, + WPBullpupRifle, + WPFirework, + WPCombatMG, + WPCarbineRifle, + WPCrowbar, + WPFlashlight, + WPDagger, + WPGrenade, + WPPoolCue, + WPBat, + WPPistol50, + WPKnife, + WPMG, + WPBullpupShotgun, + WPBZGas, + WPUnarmed, + WPGrenadeLauncher, + WPNightVision, + WPMusket, + WPProximityMine, + WPAdvancedRifle, + WPRPG, + WPPipeBomb, + WPMiniSMG, + WPSNSPistol, + WPPistolMk2, + WPAssaultRifle, + WPSpecialCarbine, + WPRevolver, + WPMarksmanRifle, + WPBattleAxe, + WPHeavyPistol, + WPKnuckleDuster, + WPMachinePistol, + WPCombatMGMk2, + WPMarksmanPistol, + WPMachete, + WPSwitchBlade, + WPAssaultShotgun, + WPDoubleBarrelShotgun, + WPAssaultSMG, + WPHatchet, + WPBottle, + WPCarbineRifleMk2, + WPParachute, + WPSmokeGrenade, + // Misc Settings MSMenu, MSAll, @@ -146,8 +230,6 @@ public enum Permission MSNightVision, MSThermalVision, - - // Voice Chat VCMenu, VCAll, @@ -166,18 +248,11 @@ public static void SetPermission(string permissionName, bool allowed) if (allowed) { Permissions.Add(permissionName); - } - //if (allowed) - // MainMenu.Cf.Log("Permission: " + permissionName.ToString() + " is ALLOWED."); - //else - // MainMenu.Cf.Log("Permission: " + permissionName.ToString() + " is DENIED."); } - public static bool IsAllowed(Permission permission) { - if (Permissions.Contains("Everything")) { MainMenu.Cf.Log("Everything allowed, breaking."); @@ -190,17 +265,12 @@ public static bool IsAllowed(Permission permission) { allowed = true; } - if (!allowed) { allowed = Permissions.Contains(permission.ToString()); } - - return allowed; } - - } } } diff --git a/vMenu/ValidWeapon.cs b/vMenu/ValidWeapon.cs index ef9df52b..c44dbc34 100644 --- a/vMenu/ValidWeapon.cs +++ b/vMenu/ValidWeapon.cs @@ -12,6 +12,7 @@ public struct ValidWeapon public uint Hash; public string Name; public Dictionary Components; + public Permission Perm; } public class ValidWeapons @@ -52,7 +53,8 @@ public ValidWeapons() { Hash = hash, Name = localizedName, - Components = componentHashes + Components = componentHashes, + Perm = weaponPermissions[realName] }; _validWeaponsList[num] = vw; num++; @@ -147,6 +149,92 @@ public ValidWeapons() ["SmokeGrenade"] = "Tear Gas", }; + public static Dictionary weaponPermissions = new Dictionary() + { + ["SniperRifle"] = Permission.WPSniperRifle, + ["FireExtinguisher"] = Permission.WPFireExtinguisher, + ["CompactGrenadeLauncher"] = Permission.WPCompactGrenadeLauncher, + ["Snowball"] = Permission.WPSnowball, + ["VintagePistol"] = Permission.WPVintagePistol, + ["CombatPDW"] = Permission.WPCombatPDW, + ["HeavySniperMk2"] = Permission.WPHeavySniperMk2, + ["HeavySniper"] = Permission.WPHeavySniper, + ["SweeperShotgun"] = Permission.WPSweeperShotgun, + ["MicroSMG"] = Permission.WPMicroSMG, + ["Wrench"] = Permission.WPWrench, + ["Pistol"] = Permission.WPPistol, + ["PumpShotgun"] = Permission.WPPumpShotgun, + ["APPistol"] = Permission.WPAPPistol, + ["Ball"] = Permission.WPBall, + ["Molotov"] = Permission.WPMolotov, + ["SMG"] = Permission.WPSMG, + ["StickyBomb"] = Permission.WPStickyBomb, + ["PetrolCan"] = Permission.WPPetrolCan, + ["StunGun"] = Permission.WPStunGun, + ["AssaultRifleMk2"] = Permission.WPAssaultRifleMk2, + ["HeavyShotgun"] = Permission.WPHeavyShotgun, + ["Minigun"] = Permission.WPMinigun, + ["GolfClub"] = Permission.WPGolfClub, + ["FlareGun"] = Permission.WPFlareGun, + ["Flare"] = Permission.WPFlare, + ["GrenadeLauncherSmoke"] = Permission.WPGrenadeLauncherSmoke, + ["Hammer"] = Permission.WPHammer, + ["CombatPistol"] = Permission.WPCombatPistol, + ["Gusenberg"] = Permission.WPGusenberg, + ["CompactRifle"] = Permission.WPCompactRifle, + ["HomingLauncher"] = Permission.WPHomingLauncher, + ["Nightstick"] = Permission.WPNightstick, + ["Railgun"] = Permission.WPRailgun, + ["SawnOffShotgun"] = Permission.WPSawnOffShotgun, + ["SMGMk2"] = Permission.WPSMGMk2, + ["BullpupRifle"] = Permission.WPBullpupRifle, + ["Firework"] = Permission.WPFirework, + ["CombatMG"] = Permission.WPCombatMG, + ["CarbineRifle"] = Permission.WPCarbineRifle, + ["Crowbar"] = Permission.WPCrowbar, + ["Flashlight"] = Permission.WPFlashlight, + ["Dagger"] = Permission.WPDagger, + ["Grenade"] = Permission.WPGrenade, + ["PoolCue"] = Permission.WPPoolCue, + ["Bat"] = Permission.WPBat, + ["Pistol50"] = Permission.WPPistol50, + ["Knife"] = Permission.WPKnife, + ["MG"] = Permission.WPMG, + ["BullpupShotgun"] = Permission.WPBullpupShotgun, + ["BZGas"] = Permission.WPBZGas, + ["Unarmed"] = Permission.WPUnarmed, + ["GrenadeLauncher"] = Permission.WPGrenadeLauncher, + ["NightVision"] = Permission.WPNightVision, + ["Musket"] = Permission.WPMusket, + ["ProximityMine"] = Permission.WPProximityMine, + ["AdvancedRifle"] = Permission.WPAdvancedRifle, + ["RPG"] = Permission.WPRPG, + ["PipeBomb"] = Permission.WPPipeBomb, + ["MiniSMG"] = Permission.WPMiniSMG, + ["SNSPistol"] = Permission.WPSNSPistol, + ["PistolMk2"] = Permission.WPPistolMk2, + ["AssaultRifle"] = Permission.WPAssaultRifle, + ["SpecialCarbine"] = Permission.WPSpecialCarbine, + ["Revolver"] = Permission.WPRevolver, + ["MarksmanRifle"] = Permission.WPMarksmanRifle, + ["BattleAxe"] = Permission.WPBattleAxe, + ["HeavyPistol"] = Permission.WPHeavyPistol, + ["KnuckleDuster"] = Permission.WPKnuckleDuster, + ["MachinePistol"] = Permission.WPMachinePistol, + ["CombatMGMk2"] = Permission.WPCombatMGMk2, + ["MarksmanPistol"] = Permission.WPMarksmanPistol, + ["Machete"] = Permission.WPMachete, + ["SwitchBlade"] = Permission.WPSwitchBlade, + ["AssaultShotgun"] = Permission.WPAssaultShotgun, + ["DoubleBarrelShotgun"] = Permission.WPDoubleBarrelShotgun, + ["AssaultSMG"] = Permission.WPAssaultSMG, + ["Hatchet"] = Permission.WPHatchet, + ["Bottle"] = Permission.WPBottle, + ["CarbineRifleMk2"] = Permission.WPCarbineRifleMk2, + ["Parachute"] = Permission.WPParachute, + ["SmokeGrenade"] = Permission.WPSmokeGrenade, + }; + /// /// Key = Weapon Name (NOT localized - string), value = hash (uint). /// diff --git a/vMenu/menus/WeaponOptions.cs b/vMenu/menus/WeaponOptions.cs index cdaefa52..c9676174 100644 --- a/vMenu/menus/WeaponOptions.cs +++ b/vMenu/menus/WeaponOptions.cs @@ -493,7 +493,7 @@ private void CreateMenu() foreach (ValidWeapon weapon in vw.WeaponList) { uint cat = (uint)GetWeapontypeGroup(weapon.Hash); - if (weapon.Name != null) + if (weapon.Name != null && cf.IsAllowed(weapon.Perm)) { #region Create menu for this weapon and add buttons UIMenu weaponMenu = new UIMenu("Weapon Options", weapon.Name, true)