fixed banned weapon checking
This commit is contained in:
parent
07b79cb91a
commit
a56b5f7b3f
1 changed files with 2 additions and 7 deletions
|
|
@ -917,9 +917,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
string[] BannedGiveItems = {"weapon_knife_canis","weapon_falchion","weapon_flip","weapon_knife_outdoor","weapon_knife_widowmaker","weapon_elite","weapon_knife_skeleton",
|
|
||||||
"weapon_knife_push","weapon_knife_gypsy_jackknife","weapon_gut","weapon_tactical","weapon_knife_ursus","weapon_knife_stiletto","weapon_bayonet","weapon_m9_bayonet",
|
|
||||||
"weapon_karambit","weapon_butterfly","weapon_survival_bowie","weapon_knife_cord"};
|
|
||||||
[ConsoleCommand("css_give")]
|
[ConsoleCommand("css_give")]
|
||||||
[RequiresPermissions("@css/give")]
|
[RequiresPermissions("@css/give")]
|
||||||
[CommandHelper(minArgs: 2, usage: "<#UserId Or Name> <WeaponName>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
[CommandHelper(minArgs: 2, usage: "<#UserId Or Name> <WeaponName>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||||
|
|
@ -928,13 +925,11 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
||||||
if(!GetTarget(command, out var player) || player == null || !player.IsValid) return;
|
if(!GetTarget(command, out var player) || player == null || !player.IsValid) return;
|
||||||
string weaponName = command.GetArg(2);
|
string weaponName = command.GetArg(2);
|
||||||
|
|
||||||
//check if weapon is inside the bannedItems
|
//check if weapon is knife
|
||||||
foreach(string bannedWeapon in BannedGiveItems){
|
if(weaponName.Contains("knife") || weaponName.Contains("bayonet")){
|
||||||
if(bannedWeapon.Equals(weaponName.ToLower())){
|
|
||||||
command.ReplyToCommand($"Cannot Give {weaponName} because it's illegal to be given.");
|
command.ReplyToCommand($"Cannot Give {weaponName} because it's illegal to be given.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
//give the weapon to player and announce it
|
//give the weapon to player and announce it
|
||||||
player.GiveNamedItem(weaponName);
|
player.GiveNamedItem(weaponName);
|
||||||
Server.PrintToChatAll(Helper.ReplaceTags($" {Config.Prefix} {Config.Messages.AdminGiveMessage}".Replace("{ADMIN}", caller?.PlayerName == null ? "Console" : caller.PlayerName).Replace("{WEAPON}", weaponName.Split("_")[1])).Replace("{PLAYER}",player.PlayerName));
|
Server.PrintToChatAll(Helper.ReplaceTags($" {Config.Prefix} {Config.Messages.AdminGiveMessage}".Replace("{ADMIN}", caller?.PlayerName == null ? "Console" : caller.PlayerName).Replace("{WEAPON}", weaponName.Split("_")[1])).Replace("{PLAYER}",player.PlayerName));
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue