Fixed restarting script losing licenses

This commit is contained in:
ElPumpo
2018-11-17 22:43:41 +01:00
parent d2a369e825
commit b0d73a4d79
3 changed files with 13 additions and 32 deletions
+1 -15
View File
@@ -27,18 +27,6 @@ ESX.RegisterServerCallback('esx_weashop:getShop', function(source, cb)
cb(shopItems)
end)
function LoadLicenses(source)
TriggerEvent('esx_license:getLicenses', source, function(licenses)
TriggerClientEvent('esx_weashop:loadLicenses', source, licenses)
end)
end
if Config.LicenseEnable then
AddEventHandler('esx:playerLoaded', function(source)
LoadLicenses(source)
end)
end
ESX.RegisterServerCallback('esx_weashop:buyLicense', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
@@ -46,10 +34,8 @@ ESX.RegisterServerCallback('esx_weashop:buyLicense', function(source, cb)
xPlayer.removeMoney(Config.LicensePrice)
TriggerEvent('esx_license:addLicense', source, 'weapon', function()
LoadLicenses(source)
cb(true)
end)
cb(true)
else
cb(false)
TriggerClientEvent('esx:showNotification', source, _U('not_enough'))