Sorry if is the wrong area, but I bring you the solution to bug problems related to conteiners, like buying bp's infinitely until crash the server, put several bps inside bps (with trash items inside or only bps and bps), throw inside the house and use the !leavehouse command (or something like that) which causes lag (maybe crash!?) or any other such crap like this.
Go to ... \ data \ npc \ lib \ npcsystem and search by: -- Handles onBuy events. If you wish to handle this yourself, use the CALLBACK_ONBUY callback.
Replace the entire function with:
Explaining:
If the player tries to buy more than X items from id Y, npc will not sell. When the player buys less than X, he will gain a cooldown of Z seconds until he can buy again. All this configurable in the table.
To harm you with this kind of bug now, only if the player has a urge to f*** with you.
Tested and fully functional in TFS 0.4 rev 3884, but is just adapting to other versions that I'm sure works.
EDIT: I do not know if already has a similar script there, but this one has made by my own.
Go to ... \ data \ npc \ lib \ npcsystem and search by: -- Handles onBuy events. If you wish to handle this yourself, use the CALLBACK_ONBUY callback.
Replace the entire function with:
Lua:
function NpcHandler:onBuy(cid, itemid, subType, amount, ignoreCap, inBackpacks)
local config = {
sto = 11000, --storage
tempo = 60, --cooldown to buy again
it = {2144, 2149}, --id of the itens that you want to "block"
total = 10 --Maximum items you can buy each time
}
if isInArray(config.it, itemid) and amount >= config.total then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "you can not buy more than "..config.total.." from this item.")
return false
elseif getPlayerStorageValue(cid, config.sto) > os.time() and isInArray(config.it, itemid) and amount <= config.total then
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_ORANGE, "wait "..(getPlayerStorageValue(cid, config.sto) - os.time()).." second(s) to buy again.")
return false
elseif isInArray(config.it, itemid) and amount <= config.total then
setPlayerStorageValue(cid, config.sto, os.time() + config.tempo)
end
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
Explaining:
If the player tries to buy more than X items from id Y, npc will not sell. When the player buys less than X, he will gain a cooldown of Z seconds until he can buy again. All this configurable in the table.
To harm you with this kind of bug now, only if the player has a urge to f*** with you.
Tested and fully functional in TFS 0.4 rev 3884, but is just adapting to other versions that I'm sure works.
EDIT: I do not know if already has a similar script there, but this one has made by my own.