diff --git a/ReallifeGamemode.Server/Commands/AdminCommands.cs b/ReallifeGamemode.Server/Commands/AdminCommands.cs index c693254d..45e951db 100644 --- a/ReallifeGamemode.Server/Commands/AdminCommands.cs +++ b/ReallifeGamemode.Server/Commands/AdminCommands.cs @@ -835,7 +835,7 @@ namespace ReallifeGamemode.Server.Commands } [Command("clothes", "~m~Benutzung: ~s~/clothes [Spieler] [Component ID] [Drawable] (Textur)")] - public void CmdAdminClothes(Client player, string name, int slot, int component, int texture = 0) + public void CmdAdminClothes(Client player, string name, int component, int drawable, int texture = 0) { if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN2) ?? true) { @@ -850,7 +850,32 @@ namespace ReallifeGamemode.Server.Commands return; } - target.SetClothes(slot, component, texture); + using(var dbContext = new DatabaseContext()) + { + User user = target.GetUser(dbContext); + bool duty = user.GetData("duty"); + CharacterCloth cloth = dbContext.CharacterClothes.Where(c => c.UserId == user.Id && c.SlotId == component && c.SlotType == 0 && c.Duty == duty).FirstOrDefault(); + if(cloth == null) + { + cloth = new CharacterCloth() + { + Duty = duty, + ClothId = drawable, + SlotId = component, + SlotType = 0, + Texture = texture, + UserId = user.Id, + }; + dbContext.CharacterClothes.Add(cloth); + } + else + { + cloth.ClothId = drawable; + cloth.Texture = texture; + } + dbContext.SaveChanges(); + target.SetClothes(component, drawable, texture); + } } [Command("props", "~m~Benutzung: ~s~/props [Spieler] [Component ID] [Drawable] (Textur)")]