From 4e4927dcfd7cf29cb4fc6965ef199a7313c45bb1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9mie=20N=27gadi?= Date: Wed, 16 Aug 2017 19:21:07 +0200 Subject: [PATCH] Add condition to close menu --- client/main.lua | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/client/main.lua b/client/main.lua index 7560c250..883501a0 100644 --- a/client/main.lua +++ b/client/main.lua @@ -19,6 +19,7 @@ local PlayerData = {} local CurrentAction = nil local CurrentActionMsg = '' local CurrentActionData = {} +local IsInShopMenu = false local Categories = {} local Vehicles = {} local LastVehicles = {} @@ -53,6 +54,8 @@ end function OpenShopMenu() + IsInShopMenu = true + ESX.UI.Menu.CloseAll() local playerPed = GetPlayerPed(-1) @@ -148,6 +151,8 @@ function OpenShopMenu() if hasEnoughMoney then + IsInShopMenu = false + menu2.close() menu.close() @@ -212,6 +217,8 @@ function OpenShopMenu() SetEntityCoords(playerPed, Config.Zones.ShopEntering.Pos.x, Config.Zones.ShopEntering.Pos.y, Config.Zones.ShopEntering.Pos.z) end + IsInShopMenu = false + end, function(data, menu) @@ -767,7 +774,11 @@ AddEventHandler('esx_vehicleshop:hasEnteredMarker', function(zone) end) AddEventHandler('esx_vehicleshop:hasExitedMarker', function(zone) - ESX.UI.Menu.CloseAll() + + if not IsInShopMenu then + ESX.UI.Menu.CloseAll() + end + CurrentAction = nil end)