Files
esx_core/server/main.lua
T
2018-11-10 23:47:14 +01:00

19 lines
554 B
Lua

ESX = nil
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)
xPlayer.removeMoney(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)
cb(xPlayer.get('money') >= Config.Price)
end)