mirror of
https://github.com/daffyyyy/CS2-SimpleAdmin.git
synced 2026-02-18 10:43:23 +00:00
Update CS2-SimpleAdmin.cs
This commit is contained in:
@@ -1381,25 +1381,6 @@ public partial class CS2_SimpleAdmin : BasePlugin, IPluginConfig<CS2_SimpleAdmin
|
||||
Logger.LogInformation($"{caller!.PlayerName} executed command ({command.ArgString}).");
|
||||
}
|
||||
|
||||
|
||||
[ConsoleCommand("css_give")]
|
||||
[RequiresPermissions("@css/give")]
|
||||
[CommandHelper(minArgs: 2, usage: "<#UserId Or Name> <WeaponName>", whoCanExecute: CommandUsage.CLIENT_AND_SERVER)]
|
||||
public void OnGiveCommand(CCSPlayerController? caller, CommandInfo command)
|
||||
{
|
||||
if(!GetTarget(command, out var player) || player == null || !player.IsValid) return;
|
||||
string weaponName = command.GetArg(2);
|
||||
|
||||
//check if weapon is knife
|
||||
if(weaponName.Contains("_knife") || weaponName.Contains("bayonet")){
|
||||
command.ReplyToCommand($"Cannot Give {weaponName} because it's illegal to be given.");
|
||||
return;
|
||||
}
|
||||
//give the weapon to player and announce it
|
||||
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));
|
||||
}
|
||||
|
||||
private static TargetResult? GetTarget(CommandInfo command)
|
||||
{
|
||||
var matches = command.GetArgTargetResult(1);
|
||||
|
||||
Reference in New Issue
Block a user