Cleanup, fixed #6

This commit is contained in:
ElPumpo
2018-11-10 23:47:14 +01:00
parent ad356352dd
commit 5c49d02433
10 changed files with 111 additions and 159 deletions
+4 -14
View File
@@ -4,25 +4,15 @@ TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
RegisterServerEvent('esx_barbershop:pay')
AddEventHandler('esx_barbershop:pay', function()
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
local xPlayer = ESX.GetPlayerFromId(_source)
xPlayer.removeMoney(Config.Price)
TriggerClientEvent('esx:showNotification', source, _U('you_paid') .. '$' .. Config.Price)
TriggerClientEvent('esx:showNotification', source, _U('you_paid', ESX.Math.GroupDigits(Config.Price)))
end)
ESX.RegisterServerCallback('esx_barbershop:checkMoney', function(source, cb)
local xPlayer = ESX.GetPlayerFromId(source)
local _source = source
local xPlayer = ESX.GetPlayerFromId(_source)
if xPlayer.get('money') >= Config.Price then
cb(true)
else
cb(false)
end
cb(xPlayer.get('money') >= Config.Price)
end)