Smart Anti Push on player
local CONFIG = {
Delay = { Min = 200, Max = 500 }, -- Delay after each drop.
Items = {3031, 3147, 3507, 3447}, -- Items to drop.
DropCount = 2, -- How many items should throw on each drop? Example: 2 gold coins per drop. If you have a stack with 100 gold coins, it would drop 2 by 2.
SafeList = { 'friend name', 'another friend' }, -- Characters name that will not trigger this.
MaxItemsDropped = 5 -- Maximum amount of items dropped on the floor. The script will only drop items if the quantity is less than this value.
}
if connected() and paroundignore(0, table.unpack(CONFIG.SafeList)) > 0 then
if tileitemscount == nil then
function tileitemscount()
local tile_items_count = 0
local last_id = 0
local tile = gettile(posx(), posy(), posz())
for _, item in ipairs(tile.items) do
if itemhasflags(item.id, ITEM_PICKUPABLE) then
tile_items_count = tile_items_count + 1
elseif itemhasflags(item.id, ITEM_NOTMOVEABLE) then
tile_items_count = 0
end
end
return { tile_items_count, last_id }
end
end
local TILE_ITEMS_INFO = tileitemscount()
while TILE_ITEMS_INFO[1] <= CONFIG.MaxItemsDropped do
if TILE_ITEMS_INFO[1] == 0 then
LAST_ITEM = 0
else
LAST_ITEM = TILE_ITEMS_INFO[2]
end
local items_dropped_count = 0
local containers = getcontainers()
for _, container in ipairs(containers) do
for __, item in ipairs(container.items) do
if table.find(CONFIG.Items, item.id) ~= nil then
if LAST_ITEM ~= item.id then
moveitems(item.id, ground(posx(), posy(), posz()), container.index, CONFIG.DropCount)
wait(CONFIG.Delay.Min, CONFIG.Delay.Max)
items_dropped_count = items_dropped_count + 1
LAST_ITEM = item.id
end
end
end
end
if items_dropped_count == 0 then
break
end
TILE_ITEMS_INFO = tileitemscount()
end
end