esx-community/esx_thief

Support for esx 1.2

Opened this issue · 3 comments

maybe someone can add support for esx 1.2 many thanks

i am looking for this too ..

Replace in esx_thief/main/server.lua:
For Steal ITEMS: Lines 35 to 53
Last Code:
l local label = sourceXPlayer.getInventoryItem(itemName).label
local itemLimit = sourceXPlayer.getInventoryItem(itemName).limit
local sourceItemCount = sourceXPlayer.getInventoryItem(itemName).count
local targetItemCount = targetXPlayer.getInventoryItem(itemName).count

if amount > 0 and targetItemCount >= amount then
	if itemLimit ~= -1 and (sourceItemCount + amount) > itemLimit then
		TriggerClientEvent('esx:showNotification', targetXPlayer.source, _U('ex_inv_lim_target'))
		TriggerClientEvent('esx:showNotification', sourceXPlayer.source, _U('ex_inv_lim_source'))
	else
		targetXPlayer.removeInventoryItem(itemName, amount)
		sourceXPlayer.addInventoryItem(itemName, amount)

		TriggerClientEvent('esx:showNotification', sourceXPlayer.source, _U('you_stole') .. ' ~g~x' .. amount .. ' ' .. label .. ' ~w~' .. _U('from_your_target') )
		TriggerClientEvent('esx:showNotification', targetXPlayer.source, _U('someone_stole') .. ' ~r~x'  .. amount .. ' ' .. label )
	end
else
	TriggerClientEvent('esx:showNotification', _source, _U('invalid_quantity'))
end

New Code:

local label = sourceXPlayer.getInventoryItem(itemName).label

if amount > 0 then
	if sourceXPlayer.canCarryItem(itemName, amount) then
		targetXPlayer.removeInventoryItem(itemName, amount)
		sourceXPlayer.addInventoryItem(itemName, amount)
		TriggerClientEvent('esx:showNotification', sourceXPlayer.source, _U('you_stole') .. ' ~g~x' .. amount .. ' ' .. label .. ' ~w~' .. _U('from_your_target') )
		TriggerClientEvent('esx:showNotification', targetXPlayer.source, _U('someone_stole') .. ' ~r~x'  .. amount .. ' ' .. label )
	else 
		sourceXPlayer.showNotification("No puedes con tanto peso", sourceXPlayer.name)
	end
else
	TriggerClientEvent('esx:showNotification', _source, _U('invalid_quantity'))
end

Replace in esx_thief/main/server.lua:
For MONEY: Lines 56 to 66
Last Code:

if amount > 0 and targetXPlayer.get('money') >= amount then
	targetXPlayer.removeMoney(amount)
	sourceXPlayer.addMoney(amount)

	TriggerClientEvent('esx:showNotification', sourceXPlayer.source, _U('you_stole') .. ' ~g~$' .. amount .. ' ~w~' .. _U('from_your_target') )
	TriggerClientEvent('esx:showNotification', targetXPlayer.source, _U('someone_stole') .. ' ~r~$'  .. amount )
else
	TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount'))
end

New Code:
if amount > 0 and targetXPlayer.getAccount("money").money >= amount then
targetXPlayer.removeMoney(amount)
sourceXPlayer.addMoney(amount)
TriggerClientEvent('esx:showNotification', sourceXPlayer.source, _U('you_stole') .. ' g$' .. amount .. ' w' .. _U('from_your_target') )
TriggerClientEvent('esx:showNotification', targetXPlayer.source, _U('someone_stole') .. ' r$' .. amount )
else
TriggerClientEvent('esx:showNotification', _source, _U('imp_invalid_amount'))
end