Add /giveweapon command
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user