Add condition to close menu

This commit is contained in:
Jérémie N'gadi
2017-08-16 19:21:07 +02:00
parent b02abda2e5
commit 4e4927dcfd
+12 -1
View File
@@ -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)