Some polish community laged my old server by buying many items at the same time from a NPC and droping it on the same tile always.
This should fix the problem. ( it worked for me perfectly )
go in data/npc/lib/npchandler.lua and replace this
with this
and add this to your data/scripts/spiderman.lua
( made by sarah wesker if im not wrong )
and enable onMoveItem in events.xml
Then you should be fine
This happens most time only on highexp ots with alot of money
This should fix the problem. ( it worked for me perfectly )
go in data/npc/lib/npchandler.lua and replace this
Lua:
-- Handles onBuy events. If you wish to handle this yourself, use the CALLBACK_ONBUY callback.
function NpcHandler:onBuy(creature, itemid, subType, amount, ignoreCap, inBackpacks)
local cid = creature:getId()
local callback = self:getCallback(CALLBACK_ONBUY)
if callback == nil or callback(cid, itemid, subType, amount, ignoreCap, inBackpacks) then
if self:processModuleCallback(CALLBACK_ONBUY, cid, itemid, subType, amount, ignoreCap, inBackpacks) then
--
end
end
end
with this
Lua:
local exhaustTable = {}
local timeToBuy = 1
-- Handles onBuy events. If you wish to handle this yourself, use the CALLBACK_ONBUY callback.
function NpcHandler:onBuy(creature, itemid, subType, amount, ignoreCap, inBackpacks)
local cid = creature:getId()
local callback = self:getCallback(CALLBACK_ONBUY)
local player = Player(cid)
local playerGuid = player:getGuid()
local timeAmount = exhaustTable[playerGuid] -- exhaustTable name must be changed always to the current name you use for the table
if timeAmount and timeAmount > os.time() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You must wait " .. (timeAmount - os.time()) .. " seconds to buy the next item.")
return true
end
if not player:getFreeCapacity() then
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You need free capacity to buy this item.")
return true
end
if callback == nil or callback(cid, itemid, subType, amount, ignoreCap, inBackpacks) then
if self:processModuleCallback(CALLBACK_ONBUY, cid, itemid, subType, amount, ignoreCap, inBackpacks) then
exhaustTable[playerGuid] = os.time() + timeToBuy
end
end
end
and add this to your data/scripts/spiderman.lua
( made by sarah wesker if im not wrong )
Lua:
local tileLimit = 50
local protectionTileLimit = 50
local houseTileLimit = 50
local ec = EventCallback
function ec.onMoveItem(player, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
local tile = Tile(toPosition)
if tile then
local itemLimit = tile:getHouse() and houseTileLimit or tile:hasFlag(TILESTATE_PROTECTIONZONE) and protectionTileLimit or tileLimit
if itemLimit > 0 and tile:getThingCount() > itemLimit and item:getType():getType() ~= ITEM_TYPE_MAGICFIELD then
--player:sendTextMessage(MESSAGE_INFO_DESCR, "You can not put more items on this tile.")
return false
end
end
return true
end
ec:register()
and enable onMoveItem in events.xml
Then you should be fine
This happens most time only on highexp ots with alot of money
Last edited: