fix /clothes

This commit is contained in:
hydrant
2020-05-10 13:53:03 +02:00
parent 53d133ef89
commit e2428a34c8

View File

@@ -1189,7 +1189,7 @@ namespace ReallifeGamemode.Server.Commands
} }
[Command("clothes", "~m~Benutzung: ~s~/clothes [Spieler] [Component ID] [Drawable] (Textur)")] [Command("clothes", "~m~Benutzung: ~s~/clothes [Spieler] [Component ID] [Drawable] (Textur)")]
public void CmdAdminClothes(Player player, string name, int? component = null, int? drawable = null, int texture = 0) public void CmdAdminClothes(Player player, string name, int component, int drawable, int texture = 0)
{ {
if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN2) ?? true) if (!player.GetUser()?.IsAdmin(AdminLevel.ADMIN2) ?? true)
{ {
@@ -1197,12 +1197,6 @@ namespace ReallifeGamemode.Server.Commands
return; return;
} }
if (name == null || component == null || drawable == null)
{
player.SendChatMessage("~m~Benutzung: ~s~/clothes [Spieler] [Component ID] [Drawable] (Textur)");
return;
}
Player target = PlayerService.GetPlayerByNameOrId(name); Player target = PlayerService.GetPlayerByNameOrId(name);
if (target == null || !target.IsLoggedIn()) if (target == null || !target.IsLoggedIn())
{ {
@@ -1220,8 +1214,8 @@ namespace ReallifeGamemode.Server.Commands
cloth = new CharacterCloth() cloth = new CharacterCloth()
{ {
Duty = duty, Duty = duty,
ClothId = drawable.Value, ClothId = drawable,
SlotId = component.Value, SlotId = component,
SlotType = 0, SlotType = 0,
Texture = texture, Texture = texture,
UserId = user.Id, UserId = user.Id,
@@ -1230,11 +1224,11 @@ namespace ReallifeGamemode.Server.Commands
} }
else else
{ {
cloth.ClothId = drawable.Value; cloth.ClothId = drawable;
cloth.Texture = texture; cloth.Texture = texture;
} }
dbContext.SaveChanges(); dbContext.SaveChanges();
target.SetClothes(component.Value, drawable.Value, texture); NAPI.Player.SetPlayerClothes(player, component, drawable, texture);
} }
} }