Solved Infinite Items when gathering?

Jakkee

Retired Staff
Retired Staff
Plugin Developer
Jul 28, 2014
1,465
945
113
Australia
So @chaochaoq9 has pointed out that players can gather a full inventory worth of any item.
Demo on how to do it here:

I have tried to stop the plugin from gathering at all by doing:
JavaScript:
function On_PlayerGathering(Player, GatherEvent) {
    switch (GatherEvent.Item) {
        case 'Wood':
            if (Player.Inventory.FreeSlots == 0) {
                return;
            }else if(Player.Inventory.FreeSlots > 0){
                var Rate = parseInt(DataStore.Get("GatherRate", "Wood"));
                var Gathered = (Math.round(GatherEvent.Quantity) * (Rate-1));
                Player.Inventory.AddItem(GatherEvent.Item, Gathered);
                Player.InventoryNotice(Gathered + " x " + GatherEvent.Item);
            }
        break;
    }
}
But it still seems to increase the gather rate with every swing (The Youtube video shows you) silently in the background.

Now apparently this glitch works only modded servers with 3x + gather, is it possible that it may be just the server mod?
 
Fix

if(Player.Inventory.FreeSlots==1){
return;
}elseif(Player.Inventory.FreeSlots==0){


Or maybe it's reversed o_O so 1 in the lower one.

if(Player.Inventory.FreeSlots==0){
return;
}elseif(Player.Inventory.FreeSlots>0){
 
Fix

if(Player.Inventory.FreeSlots==1){
return;
}elseif(Player.Inventory.FreeSlots==0){


Or maybe it's reversed o_O so 1 in the lower one.

if(Player.Inventory.FreeSlots==0){
return;
}elseif(Player.Inventory.FreeSlots>0){
Still doesn't effect it. It seems to silently multiply when inventory it full.
I thought maybe dropping or removing the item when inventory is full would work, but it would only work if there was the gathered item in there.
JavaScript:
var Rate = parseInt(DataStore.Get("GatherRate", "Wood"));
var Gathered = (Math.round(GatherEvent.Quantity) * (Rate-1));
Player.Inventory.RemoveItem(GatherEvent.Item, Gathered);
 
Dretax made this


function On_PlayerGathering(Player, GatherEvent) {
var quantity = GatherEvent.Quantity;
var inventory = Player.Inventory;
var free = inventory.FreeSlots;
if (free == 0 || free == 1) {
GatherEvent.Quantity = quantity - quantity;
}
}
 
Dretax made this


function On_PlayerGathering(Player, GatherEvent) {
var quantity = GatherEvent.Quantity;
var inventory = Player.Inventory;
var free = inventory.FreeSlots;
if (free == 0 || free == 1) {
GatherEvent.Quantity = quantity - quantity;
}
}
This has seemed to have worked! Thanks!
JavaScript:
else if(Player.Inventory.FreeSlots == 0){
                var Full = GatherEvent.Quantity
                GatherEvent.Quantity = Full - Full;
                Player.Notice("Inventory full, can't gather.");
                Player.InventoryNotice("0 x " + GatherEvent.Item);
                return;
            }
 
GatherEvent.Quantity = quantity - quantity;
uhm....
GatherEvent.Quantity = 0;
 
  • Useful
Reactions: Jakkee
Dretax made this


function On_PlayerGathering(Player, GatherEvent) {
var quantity = GatherEvent.Quantity;
var inventory = Player.Inventory;
var free = inventory.FreeSlots;
if (free == 0 || free == 1) {
GatherEvent.Quantity = quantity - quantity;
}
}
:P Ty for poiting it out