mirror of
https://github.com/esx-framework/esx_core.git
synced 2026-09-04 16:23:21 +00:00
Merge pull request #19 from ElPumpo/master
Fixed exploit: taking more than you can carry
This commit is contained in:
@@ -1,9 +0,0 @@
|
|||||||
root = true
|
|
||||||
|
|
||||||
[*]
|
|
||||||
indent_size = 2
|
|
||||||
indent_style = space
|
|
||||||
end_of_line = lf
|
|
||||||
charset = utf-8
|
|
||||||
trim_trailing_whitespace = true
|
|
||||||
insert_final_newline = true
|
|
||||||
+1
-1
@@ -2,7 +2,7 @@ resource_manifest_version '44febabe-d386-4d18-afbe-5e627f4af937'
|
|||||||
|
|
||||||
description 'ESX Property'
|
description 'ESX Property'
|
||||||
|
|
||||||
version '1.0.1'
|
version '1.0.2'
|
||||||
|
|
||||||
server_scripts {
|
server_scripts {
|
||||||
'@es_extended/locale.lua',
|
'@es_extended/locale.lua',
|
||||||
|
|||||||
@@ -29,5 +29,7 @@ Locales['en'] = {
|
|||||||
['not_enough'] = 'you do not have enough money',
|
['not_enough'] = 'you do not have enough money',
|
||||||
['invalid_quantity'] = 'invalid quantity',
|
['invalid_quantity'] = 'invalid quantity',
|
||||||
['paid_rent'] = 'you ~g~paid~s~ your rent: ~g~$',
|
['paid_rent'] = 'you ~g~paid~s~ your rent: ~g~$',
|
||||||
|
['not_enough_in_property'] = 'there\'s not enough of ~r~that item~w~ in the property!',
|
||||||
|
['player_cannot_hold'] = 'you do ~r~not~w~ have enough ~y~free space~w~ in your inventory!',
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+21
-18
@@ -257,26 +257,29 @@ end)
|
|||||||
RegisterServerEvent('esx_property:getItem')
|
RegisterServerEvent('esx_property:getItem')
|
||||||
AddEventHandler('esx_property:getItem', function(owner, type, item, count)
|
AddEventHandler('esx_property:getItem', function(owner, type, item, count)
|
||||||
|
|
||||||
local _source = source
|
local _source = source
|
||||||
local xPlayer = ESX.GetPlayerFromId(_source)
|
local xPlayer = ESX.GetPlayerFromId(_source)
|
||||||
local xPlayerOwner = ESX.GetPlayerFromIdentifier(owner)
|
local xPlayerOwner = ESX.GetPlayerFromIdentifier(owner)
|
||||||
|
|
||||||
if type == 'item_standard' then
|
if type == 'item_standard' then
|
||||||
|
local sourceItem = xPlayer.getInventoryItem(item)
|
||||||
|
TriggerEvent('esx_addoninventory:getInventory', 'property', xPlayerOwner.identifier, function(inventory)
|
||||||
|
|
||||||
TriggerEvent('esx_addoninventory:getInventory', 'property', xPlayerOwner.identifier, function(inventory)
|
-- is there enough in the property?
|
||||||
|
if count > 0 and inventory.getItem(item).count >= count then
|
||||||
local roomItemCount = inventory.getItem(item).count
|
|
||||||
|
-- can the player carry the said amount of x item?
|
||||||
if roomItemCount >= count then
|
if sourceItem.limit ~= -1 and (sourceItem.count + count) > sourceItem.limit then
|
||||||
inventory.removeItem(item, count)
|
TriggerClientEvent('esx:showNotification', _source, _U('player_cannot_hold'))
|
||||||
xPlayer.addInventoryItem(item, count)
|
else
|
||||||
else
|
inventory.removeItem(item, count)
|
||||||
TriggerClientEvent('esx:showNotification', _source, _U('invalid_quantity'))
|
xPlayer.addInventoryItem(item, count)
|
||||||
end
|
end
|
||||||
|
else
|
||||||
end)
|
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_in_property'))
|
||||||
|
end
|
||||||
end
|
end)
|
||||||
|
end
|
||||||
|
|
||||||
if type == 'item_account' then
|
if type == 'item_account' then
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user