From acb2cbc9ba5c3884fda5c1c640ebebec4b7b9976 Mon Sep 17 00:00:00 2001 From: hydrant Date: Thu, 27 May 2021 23:50:21 +0200 Subject: [PATCH] evtl fix hanf --- ReallifeGamemode.Client/drugs/hanf.ts | 6 +++--- ReallifeGamemode.Server/Managers/HanfManager.cs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/ReallifeGamemode.Client/drugs/hanf.ts b/ReallifeGamemode.Client/drugs/hanf.ts index ac37a8d3..d40f50b7 100644 --- a/ReallifeGamemode.Client/drugs/hanf.ts +++ b/ReallifeGamemode.Client/drugs/hanf.ts @@ -335,11 +335,11 @@ export default function hanfSystem(globalData: IGlobalData) { mp.events.addDataHandler("hanfData", (entity: EntityMp, value) => { if (entity == mp.players.local) { - + updateHanf(value); } }); - mp.events.add("SERVER:Hanf_UpdateHanfData", dataJson => { + function updateHanf(dataJson: string) { var data: Array = >JSON.parse(dataJson) var newPlants = data.filter(d => currentHanfData.filter(x => x.Id === d.Id).length == 0); @@ -382,7 +382,7 @@ export default function hanfSystem(globalData: IGlobalData) { }); currentHanfData = data; - }); + } function getPlantModel(plant: CannabisData): number { var diff = Date.now() - Date.parse(plant.Time); diff --git a/ReallifeGamemode.Server/Managers/HanfManager.cs b/ReallifeGamemode.Server/Managers/HanfManager.cs index d70c9adf..e76f95eb 100644 --- a/ReallifeGamemode.Server/Managers/HanfManager.cs +++ b/ReallifeGamemode.Server/Managers/HanfManager.cs @@ -289,8 +289,8 @@ namespace ReallifeGamemode.Server.Managers { cannabisData ??= _currentCannabisData; await NAPI.Task.WaitForMainThread(); - //player.SetSharedData("hanfData", JsonConvert.SerializeObject(cannabisData)); - player.TriggerEvent("SERVER:Hanf_UpdateHanfData"); + player.SetSharedData("hanfData", JsonConvert.SerializeObject(cannabisData)); + //player.TriggerEvent("SERVER:Hanf_UpdateHanfData"); } [RemoteEvent("CLIENT:Hanf_BuySeeds")]