try fix
This commit is contained in:
@@ -5,6 +5,7 @@ using Newtonsoft.Json;
|
||||
using ReallifeGamemode.Database.Entities;
|
||||
using ReallifeGamemode.Database.Models;
|
||||
using ReallifeGamemode.Server.Extensions;
|
||||
using System;
|
||||
|
||||
namespace ReallifeGamemode.Server.Events
|
||||
{
|
||||
@@ -181,7 +182,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
}
|
||||
|
||||
[RemoteEvent("SERVER:BuyCharacterClothes")]
|
||||
public void RmtEvent_BuyClothes(Player client, string type, string jsonData, byte hair)
|
||||
public void RmtEvent_BuyClothes(Player client, string type, string jsonData)
|
||||
{
|
||||
/*
|
||||
* [0] ComponentID
|
||||
@@ -281,7 +282,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
|
||||
if(data[0] == 2){
|
||||
User payer = client.GetUser(dbContext);
|
||||
payer.Character.Hair = hair;
|
||||
payer.Character.Hair = Convert.ToByte(data[2]);
|
||||
dbContext.SaveChanges();
|
||||
}
|
||||
|
||||
@@ -292,43 +293,7 @@ namespace ReallifeGamemode.Server.Events
|
||||
client.TriggerEvent("clothesMenu:updateLast", data[2], data[1], data[4], data[5], data[3]);
|
||||
}
|
||||
}
|
||||
[RemoteEvent("SERVER:BuyHair")]
|
||||
public void RmtEvent_BuyHair(Player client, string type, string jsonData, byte hair)
|
||||
{
|
||||
/*
|
||||
* [0] ComponentID
|
||||
* [1] TextureID
|
||||
* [2] ClotheID
|
||||
* [3] TorsoID
|
||||
* [4] UndershirtID
|
||||
* [5] UndershirtTextureID
|
||||
* [6] Price
|
||||
*/
|
||||
|
||||
int[] data = JsonConvert.DeserializeObject<int[]>(jsonData);
|
||||
User user = client.GetUser();
|
||||
if (user.Handmoney < data[6])
|
||||
{
|
||||
client.TriggerEvent("clothesMenu:Error");
|
||||
return;
|
||||
}
|
||||
|
||||
if (type == "clothe")
|
||||
{
|
||||
|
||||
client.SetClothes(data[0], data[2], data[1]);
|
||||
|
||||
using (var dbContext = new DatabaseContext())
|
||||
{
|
||||
User payer = client.GetUser(dbContext);
|
||||
|
||||
client.GetUser(dbContext).Handmoney -= data[6];
|
||||
payer.Character.Hair = hair;
|
||||
dbContext.SaveChanges();
|
||||
//client.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
[RemoteEvent("SERVER:BuyHairColor")]
|
||||
public void BuyHairColor(Player client, byte HairColor)
|
||||
|
||||
Reference in New Issue
Block a user