mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-30 17:58:54 +00:00
Add files
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
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)
|
||||
Reference in New Issue
Block a user