mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-08-31 18:28:52 +00:00
Fixed #9, fixed dead opening f6 menu, fixed restarting script, fixed exploit taking more than you can carry
This commit is contained in:
+21
-18
@@ -7,7 +7,7 @@ if Config.MaxInService ~= -1 then
|
||||
end
|
||||
|
||||
TriggerEvent('esx_phone:registerNumber', 'taxi', _U('taxi_client'), true, true)
|
||||
TriggerEvent('esx_society:registerSociety', 'taxi', 'Taxi', 'society_taxi', 'society_taxi', 'society_taxi', {type = 'private'})
|
||||
TriggerEvent('esx_society:registerSociety', 'taxi', 'Taxi', 'society_taxi', 'society_taxi', 'society_taxi', {type = 'public'})
|
||||
|
||||
RegisterServerEvent('esx_taxijob:success')
|
||||
AddEventHandler('esx_taxijob:success', function()
|
||||
@@ -48,24 +48,27 @@ end)
|
||||
|
||||
RegisterServerEvent('esx_taxijob:getStockItem')
|
||||
AddEventHandler('esx_taxijob:getStockItem', function(itemName, count)
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_taxi', function(inventory)
|
||||
local item = inventory.getItem(itemName)
|
||||
local sourceItem = xPlayer.getInventoryItem(itemName)
|
||||
|
||||
local xPlayer = ESX.GetPlayerFromId(source)
|
||||
|
||||
TriggerEvent('esx_addoninventory:getSharedInventory', 'society_taxi', 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, _U('quantity_invalid'))
|
||||
end
|
||||
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_withdrawn') .. count .. ' ' .. item.label)
|
||||
|
||||
end)
|
||||
|
||||
-- is there enough in the society?
|
||||
if count > 0 and item.count >= count then
|
||||
|
||||
-- can the player carry the said amount of x item?
|
||||
if sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('player_cannot_hold'))
|
||||
else
|
||||
inventory.removeItem(itemName, count)
|
||||
xPlayer.addInventoryItem(itemName, count)
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('have_withdrawn') .. count .. ' ' .. item.label)
|
||||
end
|
||||
else
|
||||
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('quantity_invalid'))
|
||||
end
|
||||
end)
|
||||
end)
|
||||
|
||||
ESX.RegisterServerCallback('esx_taxijob:getStockItems', function(source, cb)
|
||||
|
||||
Reference in New Issue
Block a user