Finish Inventory-Backend
This commit is contained in:
@@ -80,7 +80,7 @@ namespace reallife_gamemode.Server.Commands
|
||||
}
|
||||
|
||||
[Command("giveitem", "~m~Benutzung: ~s~/giveitem [Target] [Item ID] [Anzahl]")]
|
||||
public void CmdAdminGiveItem(Client player, Client target, int itemId, int amount)
|
||||
public void CmdAdminGiveItem(Client player, string targetname, int itemId, int amount)
|
||||
{
|
||||
if (!player.GetUser()?.IsAdmin(AdminLevel.SUPPORTER) ?? true)
|
||||
{
|
||||
@@ -88,17 +88,15 @@ namespace reallife_gamemode.Server.Commands
|
||||
return;
|
||||
}
|
||||
|
||||
Client target = ClientService.GetClientByNameOrId(targetname);
|
||||
if (target == null || !target.IsLoggedIn())
|
||||
{
|
||||
ChatService.PlayerNotFound(player);
|
||||
return;
|
||||
}
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
UserItem newItem = new UserItem() { ItemId = itemId, UserId = target.GetUser().Id, Amount = amount };
|
||||
dbContext.UserItems.Add(newItem);
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
UserItem item = new UserItem() { ItemId = itemId, UserId = target.GetUser().Id, Amount = amount};
|
||||
InventoryManager.AddItemToInventory(target, item);
|
||||
}
|
||||
|
||||
#region Support
|
||||
|
||||
Reference in New Issue
Block a user