mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 10:18:54 +00:00
Use new boss menu + Add chest
This commit is contained in:
@@ -163,6 +163,50 @@ AddEventHandler('esx_vehicleshop:setVehicleForAllPlayers', function(props, x, y,
|
||||
TriggerClientEvent('esx_vehicleshop:setVehicle', -1, props, x, y, z, radius)
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_vehicleshop:getStockItem')
|
||||
AddEventHandler('esx_vehicleshop:getStockItem', function(itemName, count)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_vehicleshop', function(inventory)
|
||||
|
||||
local item = inventory.getItem(itemName)
|
||||
|
||||
if item.count >= count then
|
||||
inventory.removeItem(itemName, count)
|
||||
xPlayer.addInventoryItem(itemName, count)
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide')
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez retiré x' .. count .. ' ' .. item.label)
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
RegisterServerEvent('esx_vehicleshop:putStockItems')
|
||||
AddEventHandler('esx_vehicleshop:putStockItems', function(itemName, count)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_vehicleshop', function(inventory)
|
||||
|
||||
local item = inventory.getItem(itemName)
|
||||
|
||||
if item.count >= 0 then
|
||||
xPlayer.removeInventoryItem(itemName, count)
|
||||
inventory.addItem(itemName, count)
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Quantité invalide')
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, 'Vous avez ajouté x' .. count .. ' ' .. item.label)
|
||||
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_vehicleshop:getCategories', function(source, cb)
|
||||
cb(Categories)
|
||||
end)
|
||||
@@ -397,6 +441,26 @@ ESX.RegisterServerCallback('esx_vehicleshop:resellVehicle', function(source, cb,
|
||||
|
||||
end)
|
||||
|
||||
|
||||
ESX.RegisterServerCallback('esx_vehicleshop:getStockItems', function(source, cb)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_vehicleshop', function(inventory)
|
||||
cb(inventory.items)
|
||||
end)
|
||||
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_vehicleshop:getPlayerInventory', function(source, cb)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
local items = xPlayer.inventory
|
||||
|
||||
cb({
|
||||
items = items
|
||||
})
|
||||
|
||||
end)
|
||||
|
||||
if Config.EnablePvCommand then
|
||||
|
||||
TriggerEvent('es:addCommand', 'pv', function(source, args, user)
|
||||
|
||||
Reference in New Issue
Block a user