try fix friseur

This commit is contained in:
michael.reiswich
2021-01-27 22:24:41 +01:00
parent f693f3ac66
commit 4ef28ae9b2
2 changed files with 39 additions and 1 deletions

View File

@@ -279,7 +279,7 @@ export default function friseurShopList(globalData: IGlobalData) {
if (lastClothing.drawable == currentItem.ClotheId && lastClothing.texture == currentTexture) {
mp.game.audio.playSoundFrontend(1, "Hack_Failed", "DLC_HEIST_BIOLAB_PREP_HACKING_SOUNDS", true);
} else {
mp.events.callRemote("SERVER:BuyCharacterClothes", "clothe", JSON.stringify(serverData), currentItem.CloteID);
mp.events.callRemote("SERVER:BuyHair", "clothe", JSON.stringify(serverData), currentItem.CloteID);
mp.events.call("friseurMenu:close");
}

View File

@@ -278,6 +278,7 @@ namespace ReallifeGamemode.Server.Events
undershirt.Texture = data[5];
}
}
client.GetUser(dbContext).Handmoney -= data[6];
dbContext.SaveChanges();
//client.TriggerEvent("SERVER:SET_HANDMONEY", user.Handmoney);
@@ -285,6 +286,43 @@ 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)