From c9381be95334d12e043a0b18daef09685a1a7a83 Mon Sep 17 00:00:00 2001 From: Eclipse Date: Thu, 1 Jan 2026 19:54:03 +0100 Subject: [PATCH] fix yim menu crashes Ensure local ped is initialized only after being rendered for the first time. --- YimMenu/Ultimate_Menu_Legacy.lua | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/YimMenu/Ultimate_Menu_Legacy.lua b/YimMenu/Ultimate_Menu_Legacy.lua index e1b59a6..95841d5 100644 --- a/YimMenu/Ultimate_Menu_Legacy.lua +++ b/YimMenu/Ultimate_Menu_Legacy.lua @@ -1,3 +1,24 @@ +-- only initialize if local ped is rendered 1st time + +script.run_in_fiber(function() + local ped = 0 + + if NETWORK and NETWORK.NETWORK_IS_SESSION_STARTED then + repeat + ped = PLAYER.PLAYER_PED_ID() + until NETWORK.NETWORK_IS_PLAYER_ACTIVE(PLAYER.PLAYER_ID()) and ped ~= 0 and ENTITY.DOES_ENTITY_EXIST(ped) + else + repeat + ped = PLAYER.PLAYER_PED_ID() + until ped ~= 0 and ENTITY.DOES_ENTITY_EXIST(ped) + end + + repeat + until PLAYER.IS_PLAYER_CONTROL_ON(PLAYER.PLAYER_ID()) + + ENTITY.SET_ENTITY_HEALTH(ped, 200) +end) + --Required Stats---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- local function MPX()