fix hanf rpc
This commit is contained in:
@@ -453,7 +453,7 @@ namespace ReallifeGamemode.Server.Managers
|
||||
player.SyncAnimation("harvestPlant");
|
||||
plant.Harvested = true;
|
||||
|
||||
var modelToGet = await player.TriggerProcedure("SERVER:Hanf_GetModelToGivePlayer", plant.Id);
|
||||
var modelToGet = GetModelFromPlant(plant);
|
||||
player.SetData("HoldingCannabisPlant", modelToGet);
|
||||
player.AddAttachment("CannabisPlantInHand" + modelToGet, false);
|
||||
}
|
||||
@@ -463,6 +463,23 @@ namespace ReallifeGamemode.Server.Managers
|
||||
UpdateHanfWorldData(dbContext);
|
||||
}
|
||||
|
||||
private uint GetModelFromPlant(CannabisPlant data)
|
||||
{
|
||||
var cannabisTime = (DateTime.Now - data.PlantDate).TotalMinutes;
|
||||
if (cannabisTime <= 30)
|
||||
{
|
||||
return NAPI.Util.GetHashKey("bkr_prop_weed_bud_pruned_01a");
|
||||
}
|
||||
else if (cannabisTime <= 60 * 4)
|
||||
{
|
||||
return NAPI.Util.GetHashKey("prop_weed_02");
|
||||
}
|
||||
else
|
||||
{
|
||||
return NAPI.Util.GetHashKey("prop_weed_01");
|
||||
}
|
||||
}
|
||||
|
||||
internal static bool IsPlayerNearCannabisSellPoint(Player player)
|
||||
{
|
||||
return _cannabisSellPoints.Any(p => p.DistanceTo(player.Position) <= 3);
|
||||
|
||||
Reference in New Issue
Block a user