vlt fix clothing

This commit is contained in:
hydrant
2020-05-10 13:29:11 +02:00
parent 81a2108ddb
commit 53d133ef89

View File

@@ -1,4 +1,4 @@
using System.Collections.Generic;
using System.Collections.Generic;
using System.Linq;
using GTANetworkAPI;
using Newtonsoft.Json;
@@ -111,7 +111,18 @@ namespace ReallifeGamemode.Server.Events
{
for (var x = 0; x < slotType.Length; x++)
{
var loopCloth = context.CharacterClothes.FirstOrDefault(u => u.UserId == user.Id && u.SlotType == slotType[x] && u.SlotId == slotId[x]);
var loopCloth = context.CharacterClothes.FirstOrDefault(u => u.UserId == user.Id && u.SlotType == (byte)slotType[x] && u.SlotId == slotId[x]);
if (loopCloth == null)
{
loopCloth = new CharacterCloth()
{
UserId = user.Id,
SlotType = (byte)slotType[x],
SlotId = slotId[x]
};
}
loopCloth.ClothId = clothId[x];
}
CharacterCloth torso = context.CharacterClothes.FirstOrDefault(u => u.UserId == user.Id && u.SlotType == 0 && u.SlotId == 3);
@@ -190,7 +201,7 @@ namespace ReallifeGamemode.Server.Events
var clothes = dbContext.CharacterClothes.FirstOrDefault(c => c.UserId == user.Id && c.SlotId == data[0] && c.Duty == false);
if(clothes == null)
if (clothes == null)
{
CharacterCloth newCloth = new CharacterCloth
{
@@ -210,11 +221,11 @@ namespace ReallifeGamemode.Server.Events
clothes.ClothId = data[2];
clothes.Texture = data[1];
}
if(data[0] == 11)
if (data[0] == 11)
{
var torso = dbContext.CharacterClothes.FirstOrDefault(c => c.UserId == user.Id && c.SlotId == 3 && c.Duty == false);
var undershirt = dbContext.CharacterClothes.FirstOrDefault(c => c.UserId == user.Id && c.SlotId == 8 && c.Duty == false);
if(torso == null)
if (torso == null)
{
CharacterCloth newTorso = new CharacterCloth
{
@@ -232,7 +243,7 @@ namespace ReallifeGamemode.Server.Events
{
torso.ClothId = data[3];
}
if(undershirt == null)
if (undershirt == null)
{
CharacterCloth newUndershirt = new CharacterCloth
{