Check if user has payed when exiting marker

This commit is contained in:
Jérémie N'gadi
2017-08-22 10:53:07 +02:00
parent 9390b2f8b0
commit a20c9b3cbd
+17 -2
View File
@@ -18,6 +18,7 @@ local LastZone = nil
local CurrentAction = nil local CurrentAction = nil
local CurrentActionMsg = '' local CurrentActionMsg = ''
local CurrentActionData = {} local CurrentActionData = {}
local HasPayed = false
Citizen.CreateThread(function() Citizen.CreateThread(function()
@@ -30,6 +31,8 @@ end)
function OpenShopMenu() function OpenShopMenu()
HasPayed = false
TriggerEvent('esx_skin:openRestrictedMenu', function(data, menu) TriggerEvent('esx_skin:openRestrictedMenu', function(data, menu)
menu.close() menu.close()
@@ -60,6 +63,8 @@ function OpenShopMenu()
TriggerServerEvent('esx_clotheshop:pay') TriggerServerEvent('esx_clotheshop:pay')
HasPayed = true
ESX.TriggerServerCallback('esx_clotheshop:checkPropertyDataStore', function(foundStore) ESX.TriggerServerCallback('esx_clotheshop:checkPropertyDataStore', function(foundStore)
if foundStore then if foundStore then
@@ -145,8 +150,8 @@ function OpenShopMenu()
'pants_2', 'pants_2',
'shoes_1', 'shoes_1',
'shoes_2', 'shoes_2',
'chain_1', 'chain_1',
'chain_2', 'chain_2',
'helmet_1', 'helmet_1',
'helmet_2', 'helmet_2',
'glasses_1', 'glasses_1',
@@ -162,8 +167,18 @@ AddEventHandler('esx_clotheshop:hasEnteredMarker', function(zone)
end) end)
AddEventHandler('esx_clotheshop:hasExitedMarker', function(zone) AddEventHandler('esx_clotheshop:hasExitedMarker', function(zone)
ESX.UI.Menu.CloseAll() ESX.UI.Menu.CloseAll()
CurrentAction = nil CurrentAction = nil
if not HasPayed then
TriggerEvent('esx_skin:getLastSkin', function(skin)
TriggerEvent('skinchanger:loadSkin', skin)
end)
end
end) end)
-- Create Blips -- Create Blips