diff --git a/Server/Commands/Admin.cs b/Server/Commands/Admin.cs index 2f0dd635..1a16b7b8 100644 --- a/Server/Commands/Admin.cs +++ b/Server/Commands/Admin.cs @@ -144,5 +144,38 @@ namespace reallife_gamemode.Server.Commands player.SendChatMessage("~m~Benutzung: ~s~/ipl [Load / Remove] [Name]"); } } + + [Command("giveweapon", "~m~Benutzung: ~s~/giveweapon [Spieler] [Waffe] [Munition]")] + public void CmdAdminGiveweapon(Client player, string name, string weapon, int ammo) + { + if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN) ?? true) + { + ChatService.NotAuthorized(player); + return; + } + + if (ammo <= 0) + { + player.SendChatMessage("~r~[FEHLER]~s~ Es muss mindestens 1 Munition vergeben werden."); + return; + } + + Client target = ClientService.GetClientByName(name); + if (target == null) + { + ChatService.PlayerNotFound(target); + return; + } + + WeaponHash wHash = NAPI.Util.WeaponNameToModel(weapon); + + if(wHash == default(WeaponHash)) + { + player.SendChatMessage("~r~[FEHLER]~s~ Diese Waffe existiert nicht."); + return; + } + + target.GiveWeapon(wHash, ammo); + } } }