Add support for new ESX weight system (#75)

* Support for new ESX

* Fix
This commit is contained in:
rex2630
2019-11-12 20:46:15 +01:00
committed by Samuel
parent 067f0b9145
commit 591aba6325
+14 -14
View File
@@ -23,9 +23,9 @@ function SetPropertyOwned(name, price, rented, owner)
TriggerClientEvent('esx_property:setPropertyOwned', xPlayer.source, name, true)
if rented then
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('rented_for', ESX.Math.GroupDigits(price)))
xPlayer.showNotification(_U('rented_for', ESX.Math.GroupDigits(price)))
else
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('purchased_for', ESX.Math.GroupDigits(price)))
xPlayer.showNotification(_U('purchased_for', ESX.Math.GroupDigits(price)))
end
end
end)
@@ -40,7 +40,7 @@ function RemoveOwnedProperty(name, owner)
if xPlayer then
TriggerClientEvent('esx_property:setPropertyOwned', xPlayer.source, name, false)
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('made_property'))
xPlayer.showNotification(_U('made_property'))
end
end)
end
@@ -166,7 +166,7 @@ AddEventHandler('esx_property:buyProperty', function(propertyName)
xPlayer.removeMoney(property.price)
SetPropertyOwned(propertyName, property.price, false, xPlayer.identifier)
else
TriggerClientEvent('esx:showNotification', source, _U('not_enough'))
xPlayer.showNotification(_U('not_enough'))
end
end)
@@ -216,15 +216,15 @@ AddEventHandler('esx_property:getItem', function(owner, type, item, count)
if count > 0 and inventoryItem.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', _source, _U('player_cannot_hold'))
else
if xPlayer.canCarryItem(item, count) then
inventory.removeItem(item, count)
xPlayer.addInventoryItem(item, count)
TriggerClientEvent('esx:showNotification', _source, _U('have_withdrawn', count, inventoryItem.label))
xPlayer.showNotification(_U('have_withdrawn', count, inventoryItem.label))
else
xPlayer.showNotification(_U('player_cannot_hold'))
end
else
TriggerClientEvent('esx:showNotification', _source, _U('not_enough_in_property'))
xPlayer.showNotification(_U('not_enough_in_property'))
end
end)
@@ -237,7 +237,7 @@ AddEventHandler('esx_property:getItem', function(owner, type, item, count)
account.removeMoney(count)
xPlayer.addAccountMoney(item, count)
else
TriggerClientEvent('esx:showNotification', _source, _U('amount_invalid'))
xPlayer.showNotification(_U('amount_invalid'))
end
end)
@@ -279,10 +279,10 @@ AddEventHandler('esx_property:putItem', function(owner, type, item, count)
TriggerEvent('esx_addoninventory:getInventory', 'property', xPlayerOwner.identifier, function(inventory)
xPlayer.removeInventoryItem(item, count)
inventory.addItem(item, count)
TriggerClientEvent('esx:showNotification', _source, _U('have_deposited', count, inventory.getItem(item).label))
xPlayer.showNotification(_U('have_deposited', count, inventory.getItem(item).label))
end)
else
TriggerClientEvent('esx:showNotification', _source, _U('invalid_quantity'))
xPlayer.showNotification(_U('invalid_quantity'))
end
elseif type == 'item_account' then
@@ -296,7 +296,7 @@ AddEventHandler('esx_property:putItem', function(owner, type, item, count)
account.addMoney(count)
end)
else
TriggerClientEvent('esx:showNotification', _source, _U('amount_invalid'))
xPlayer.showNotification(_U('amount_invalid'))
end
elseif type == 'item_weapon' then
@@ -424,7 +424,7 @@ function PayRent(d, h, m)
-- message player if connected
if xPlayer then
xPlayer.removeAccountMoney('bank', result[i].price)
TriggerClientEvent('esx:showNotification', xPlayer.source, _U('paid_rent', ESX.Math.GroupDigits(result[i].price)))
xPlayer.showNotification(_U('paid_rent', ESX.Math.GroupDigits(result[i].price)))
else -- pay rent either way
MySQL.Sync.execute('UPDATE users SET bank = bank - @bank WHERE identifier = @identifier', {
['@bank'] = result[i].price,