
Originally Posted by
Ropiderz
lua code:
MONEY = MONEY or 0
if Self.ItemCount(3031) - MONEY > 0 then
MONEY = MONEY + (Self.ItemCount(3031) - MONEY)
end
That way you'll update MONEY value constantly without losing the count.
But when a new backpack is opened, that stops working. MY suggestion is this:
lua code:local money = 0local backpacks = 0
while (true)
local value = (Self.ItemCount(3031) + (backpacks * 1900) - money
if (value > 0) then
money = money + value
elseif (value < 0) then
backpacks = backpacks+1
end
end
As long as the following statements are true, this will work:
- Gold only exists in one backpack
- Gold is not removed from this backpack
- Gold is the only thing in this backpack with the exception of one nested backpack