public void CmdWeapon(Client client, string weapon) { client.RemoveAllWeapons(); WeaponHash hash = NAPI.Util.WeaponNameToModel(weapon); AccountUtil.AddPlayerWeapon(client, hash); }
public static bool Weapon(Client client, string name) { LevelRanks levelRanks = AccountUtil.GetLevelRanks(client); WeaponHash hash = NAPI.Util.WeaponNameToModel(name); if (Array.IndexOf(WeaponNamesData.AssaultWeapons, name.ToLower()) >= 0) { if (levelRanks.MediumWeaponry <= 0) { client.SendChatMessage("~o~You are unable to wield this weapon type: ~y~Medium"); Utilities.PlaySoundFrontend(client, "ERROR", "HUD_FRONTEND_DEFAULT_SOUNDSET"); return(false); } } if (Array.IndexOf(WeaponNamesData.ShotgunWeapons, name.ToLower()) >= 0) { if (levelRanks.MediumWeaponry <= 0) { client.SendChatMessage("~o~You are unable to wield this weapon type: ~y~Medium"); Utilities.PlaySoundFrontend(client, "ERROR", "HUD_FRONTEND_DEFAULT_SOUNDSET"); return(false); } } if (Array.IndexOf(WeaponNamesData.SmgWeapons, name.ToLower()) >= 0) { if (levelRanks.LightWeaponry <= 0) { client.SendChatMessage("~o~You are unable to wield this weapon type: ~y~Light"); Utilities.PlaySoundFrontend(client, "ERROR", "HUD_FRONTEND_DEFAULT_SOUNDSET"); return(false); } } if (Array.IndexOf(WeaponNamesData.HeavyWeapons, name.ToLower()) >= 0) { if (levelRanks.HeavyWeaponry <= 0) { client.SendChatMessage("~o~You are unable to wield this weapon type: ~y~Heavy"); Utilities.PlaySoundFrontend(client, "ERROR", "HUD_FRONTEND_DEFAULT_SOUNDSET"); return(false); } } // Try adding the weapon to the player. if (!AccountUtil.AddPlayerWeapon(client, hash)) { return(false); } Utilities.PlaySoundFrontend(client, "PICK_UP_WEAPON", "HUD_FRONTEND_CUSTOM_SOUNDSET"); client.SendNotification("A weapon may be unequipped into your inventory by pressing ~o~R~w~."); return(true); }