mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
Add condition to close menu
This commit is contained in:
+12
-1
@@ -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)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user