mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 09:48:52 +00:00
29 lines
615 B
Lua
29 lines
615 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') .. '$' .. Config.Price)
|
|
|
|
end)
|
|
|
|
ESX.RegisterServerCallback('esx_barbershop:checkMoney', function(source, cb)
|
|
|
|
local _source = source
|
|
local xPlayer = ESX.GetPlayerFromId(_source)
|
|
|
|
if xPlayer.get('money') >= Config.Price then
|
|
cb(true)
|
|
else
|
|
cb(false)
|
|
end
|
|
|
|
end)
|