mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-01 10:48:52 +00:00
Initial cleanup
This commit is contained in:
+15
-17
@@ -3,16 +3,16 @@ local ItemsLabels = {}
|
||||
|
||||
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
||||
|
||||
function LoadLicenses (source)
|
||||
TriggerEvent('esx_license:getLicenses', source, function (licenses)
|
||||
TriggerClientEvent('esx_weashop:loadLicenses', source, licenses)
|
||||
end)
|
||||
function LoadLicenses(source)
|
||||
TriggerEvent('esx_license:getLicenses', source, function (licenses)
|
||||
TriggerClientEvent('esx_weashop:loadLicenses', source, licenses)
|
||||
end)
|
||||
end
|
||||
|
||||
if Config.EnableLicense == true then
|
||||
AddEventHandler('esx:playerLoaded', function (source)
|
||||
LoadLicenses(source)
|
||||
end)
|
||||
AddEventHandler('esx:playerLoaded', function (source)
|
||||
LoadLicenses(source)
|
||||
end)
|
||||
end
|
||||
|
||||
RegisterServerEvent('esx_weashop:buyLicense')
|
||||
@@ -23,7 +23,7 @@ AddEventHandler('esx_weashop:buyLicense', function ()
|
||||
if xPlayer.get('money') >= Config.LicensePrice then
|
||||
xPlayer.removeMoney(Config.LicensePrice)
|
||||
|
||||
TriggerEvent('esx_license:addLicense', _source, 'weapon', function ()
|
||||
TriggerEvent('esx_license:addLicense', _source, 'weapon', function()
|
||||
LoadLicenses(_source)
|
||||
end)
|
||||
else
|
||||
@@ -32,9 +32,9 @@ AddEventHandler('esx_weashop:buyLicense', function ()
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_weashop:requestDBItems', function(source, cb)
|
||||
MySQL.Async.fetchAll('SELECT * FROM weashops',
|
||||
{}, function(result)
|
||||
MySQL.Async.fetchAll('SELECT * FROM weashops', {}, function(result)
|
||||
local shopItems = {}
|
||||
|
||||
for i=1, #result, 1 do
|
||||
|
||||
if shopItems[result[i].name] == nil then
|
||||
@@ -50,9 +50,7 @@ ESX.RegisterServerCallback('esx_weashop:requestDBItems', function(source, cb)
|
||||
end
|
||||
|
||||
cb(shopItems)
|
||||
|
||||
end
|
||||
)
|
||||
end)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_weashop:buyItem')
|
||||
@@ -61,19 +59,19 @@ AddEventHandler('esx_weashop:buyItem', function(itemName, price, zone)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local account = xPlayer.getAccount('black_money')
|
||||
|
||||
if zone=="BlackWeashop" then
|
||||
if zone == "BlackWeashop" then
|
||||
if account.money >= price then
|
||||
xPlayer.removeAccountMoney('black_money', price)
|
||||
xPlayer.addWeapon(itemName, 42)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('buy') .. ESX.GetWeaponLabel(itemName))
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('buy', ESX.GetWeaponLabel(itemName)))
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_black'))
|
||||
end
|
||||
else
|
||||
if xPlayer.get('money') >= price then
|
||||
if xPlayer.getMoney() >= price then
|
||||
xPlayer.removeMoney(price)
|
||||
xPlayer.addWeapon(itemName, 42)
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('buy') .. ESX.GetWeaponLabel(itemName))
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('buy', ESX.GetWeaponLabel(itemName)))
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', _source, _U('not_enough'))
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user