Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't steal items from player #31

Open
Roni-H opened this issue Apr 11, 2020 · 2 comments
Open

Can't steal items from player #31

Roni-H opened this issue Apr 11, 2020 · 2 comments

Comments

@Roni-H
Copy link

Roni-H commented Apr 11, 2020

When i press [G] and try to steal items, i don't get those items. I hope this issue could be fixed as fast as possble.

@BartukyGames
Copy link

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

@BartukyGames
Copy link

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants