From d1412c74123226582513f4c2ed0112eab8ddc5e3 Mon Sep 17 00:00:00 2001 From: Ilias Rbayti <63159154+Kenshiin13@users.noreply.github.com> Date: Sun, 1 Dec 2024 01:30:29 +0100 Subject: [PATCH] fix(es_extended/client/main): track parachute opening to remove from loadout --- [core]/es_extended/client/main.lua | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/[core]/es_extended/client/main.lua b/[core]/es_extended/client/main.lua index 6a3eba71..5df66c32 100644 --- a/[core]/es_extended/client/main.lua +++ b/[core]/es_extended/client/main.lua @@ -303,7 +303,7 @@ function StartServerSyncLoops() if weaponConfig then currentWeapon.ammo = GetAmmoInPedWeapon(ESX.PlayerData.ped, currentWeapon.hash) - while (GetSelectedPedWeapon(ESX.PlayerData.ped) == currentWeapon.hash) do Citizen.Wait(500) end + while GetSelectedPedWeapon(ESX.PlayerData.ped) == currentWeapon.hash do Wait(500) end local newAmmo = GetAmmoInPedWeapon(ESX.PlayerData.ped, currentWeapon.hash) if newAmmo ~= currentWeapon.ammo then @@ -314,6 +314,22 @@ function StartServerSyncLoops() Wait(250) end end) + + CreateThread(function() + local PARACHUTE_OPENING = 1 + local PARACHUTE_OPEN = 2 + + while ESX.PlayerLoaded do + local parachuteState = GetPedParachuteState(ESX.PlayerData.ped) + + if parachuteState == PARACHUTE_OPENING or parachuteState == PARACHUTE_OPEN then + while GetPedParachuteState(ESX.PlayerData.ped) ~= -1 do Wait(1000) end + + TriggerServerEvent("esx:updateWeaponAmmo", "GADGET_PARACHUTE", 0) + end + Wait(500) + end + end) end if not Config.CustomInventory and Config.EnableDefaultInventory then