mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-29 09:18:53 +00:00
63 lines
1.3 KiB
Lua
63 lines
1.3 KiB
Lua
ESX = nil
|
|
|
|
TriggerEvent('esx:getSharedObject', function(obj) ESX = obj end)
|
|
|
|
RegisterServerEvent('esx_clotheshop:pay')
|
|
AddEventHandler('esx_clotheshop:pay', function()
|
|
|
|
local xPlayer = ESX.GetPlayerFromId(source)
|
|
|
|
xPlayer.removeMoney(Config.Price)
|
|
|
|
TriggerClientEvent('esx:showNotification', source, 'Vous avez payé $' .. Config.Price)
|
|
|
|
end)
|
|
|
|
RegisterServerEvent('esx_clotheshop:saveOutfit')
|
|
AddEventHandler('esx_clotheshop:saveOutfit', function(label, skin)
|
|
|
|
local xPlayer = ESX.GetPlayerFromId(source)
|
|
|
|
TriggerEvent('esx_datastore:getDataStore', 'property', xPlayer.identifier, function(store)
|
|
|
|
local dressing = store.get('dressing')
|
|
|
|
if dressing == nil then
|
|
dressing = {}
|
|
end
|
|
|
|
table.insert(dressing, {
|
|
label = label,
|
|
skin = skin
|
|
})
|
|
|
|
store.set('dressing', dressing)
|
|
|
|
end)
|
|
|
|
end)
|
|
|
|
ESX.RegisterServerCallback('esx_clotheshop:checkMoney', function(source, cb)
|
|
|
|
local xPlayer = ESX.GetPlayerFromId(source)
|
|
|
|
if xPlayer.get('money') >= Config.Price then
|
|
cb(true)
|
|
else
|
|
cb(false)
|
|
end
|
|
|
|
end)
|
|
|
|
ESX.RegisterServerCallback('esx_clotheshop:checkPropertyDataStore', function(source, cb)
|
|
|
|
local xPlayer = ESX.GetPlayerFromId(source)
|
|
local foundStore = false
|
|
|
|
TriggerEvent('esx_datastore:getDataStore', 'property', xPlayer.identifier, function(store)
|
|
foundStore = true
|
|
end)
|
|
|
|
cb(foundStore)
|
|
|
|
end) |