• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!
  • 2026 staff recruitment is open! Check it out and consider applying!

[TFS 1.x] How to add exhaustion/check in MoveItem?

secondlife

Active Member
Joined
Aug 1, 2009
Messages
302
Reaction score
25
Hello dear friends,
How i can add delay in moveitems? players abusing with bot, move items very fast and i get lag/freeze in-game. I need one metod to stop. Its possible?

and...
How to add protect in mailbox/parcel system?
i already try this, but not success (sry im noob)
function Player:onMoveItem(item, count, fromPosition, toPosition)
local itemType = 2595
if itemType:getWeight() > 5000 then
self:sendCancelMessage('You cannot move this object.')
return false
end
Thank you bros, hugs!!
 
In that script you are checking the weight of the itemtype, but not the weight of the item that the player is actually moving.
Try to use the params of the function in your checks (item, count, fromPosition~).
 
But I already told you what to do, if you are having errors or something just post the changes you made so we can help you.
 
Code:
local parcel = 2595
local maxWeight = 5000
function Player:onMoveItem(item, count, fromPosition, toPosition)
    if item.itemid == parcel then
        if ItemType(item.itemid):getWeight() > maxWeight then
            self:sendCancelMessage('You cannot move this object.')
            return false
        end
    end
    return true
end
 
@Codex NG, hey man.
Thank u for feedback, but this script does not work, no errors in console too.
I need one script, block the player when take parcel with 5k+ cap in mailbox (ID:2593).
Players are using this abuse in parcel, causing lag/freeze in my server. If you have one idea, i will be gratefull. Hugs!!
 
Code:
local parcel = 2595
local maxWeight = 5000
function Player:onMoveItem(item, count, fromPosition, toPosition)
    if item.itemid == parcel then
        local desc = ItemType(item.itemid):getDescription()
        desc = desc:sub(#desc - 21, #desc - 7)
        for weight in desc:gmatch('%d+') do
            if tonumber(weight) > maxWeight then
                self:sendCancelMessage('You cannot move this object.')
                return false
            end
        end
    end
    return true
end
 

Similar threads

Back
Top