VORPCORE/vorp_inventory-lua

Cannot give gold to another player

Crowlikedream opened this issue · 1 comments

Can drop gold on the ground. Cannot give any amount of gold to another player. Have the requirements installed and options turned on in the configs.

After more testing once you try to give gold to a player and you cannot, you cannot give cash to a player until you log off anc back on.

I'm too lazy to create a PR to fix this issue, so here is the patched function. the function is located in server/services/InventoryService.lua l.240

Basically, they forgot to regive the client the rights to to a transaction...

InventoryService.giveGoldToPlayer = function(target, amount)
	local _source = source
	if SvUtils.InProcessing(_source) then
		return
	end

	if Core.getUser(_source) == nil or Core.getUser(target) == nil then
		return
	end

	SvUtils.ProcessUser(_source)
	local _target = target
	local sourceCharacter = Core.getUser(_source).getUsedCharacter
	local targetCharacter = Core.getUser(_target).getUsedCharacter
	local sourceGold = sourceCharacter.gold

	if amount <= 0 then
		TriggerClientEvent("vorp:TipRight", _source, _U("TryExploits"), 3000)
		TriggerClientEvent("vorp_inventory:ProcessingReady", _source)
		Wait(3000)
	elseif sourceGold < amount then
		TriggerClientEvent("vorp:TipRight", _source, _U("NotEnoughGold"), 3000)
		TriggerClientEvent("vorp_inventory:ProcessingReady", _source)
		Wait(3000)
	else
		sourceCharacter.removeCurrency(1, amount)
		targetCharacter.addCurrency(1, amount)

		TriggerClientEvent("vorp:TipRight", _source, _U("YouPaid", tostring(amount), "ID: " .. _target), 3000)
		TriggerClientEvent("vorp:TipRight", _target, _U("YouReceived", tostring(amount), "ID: " .. _source), 3000)
		TriggerClientEvent("vorp_inventory:ProcessingReady", _source)
		Wait(3000)
	end
	SvUtils.Trem(_source)
end