Example #1
0
        public void GiveItemCMD(IPlayer player, string itemName, int itemAmount)
        {
            if (player == null || !player.Exists)
            {
                return;
            }
            if (player.AdminLevel() <= 8)
            {
                HUDHandler.SendNotification(player, 4, 5000, "Keine Rechte."); return;
            }
            if (!ServerItems.ExistItem(ServerItems.ReturnNormalItemName(itemName)))
            {
                HUDHandler.SendNotification(player, 4, 5000, $"Itemname nicht gefunden: {itemName}"); return;
            }
            ulong charId = player.GetCharacterMetaId();

            if (charId <= 0)
            {
                return;
            }
            CharactersInventory.AddCharacterItem((int)charId, itemName, itemAmount, "inventory");
            HUDHandler.SendNotification(player, 2, 5000, $"Gegenstand '{itemName}' ({itemAmount}x) erhalten.");
        }