• 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!

Lua Revscriptsys anti-trasher not working

  • Thread starter Thread starter Evil Puncker
  • Start date Start date
E

Evil Puncker

Guest
Using tfs 1.3, no errors on console, I can throw any item on the position but it doesn't move it out, the 'print' is never executed, wham am I missing?:

LUA:
local item_exceptions = {2152, 2160, 5792, 5793, 5794, 5795, 5796, 5797}
local antiTrasher = MoveEvent()

function onAddItem(moveitem, tileitem, position)
    if not isInArray(item_exceptions, moveitem.itemid) then
        print("executed")
        moveitem:moveTo(moveitem.itemid, Position(1531,1152,7))
    end
    return true
end

antiTrasher:position(Position(1527,1152,7))
antiTrasher:type("additem")
antiTrasher:register()
 
Solution
E
I think it should be
LUA:
function antiTrasher.onAddItem(moveitem, tileitem, position)
thanks but it didn't worked either, so I just deleted the script and added the following lines to onMove player event and it worked, thanks for the help tho, here is the code in case anyone wants:

LUA:
    -- add this at the top of the file
    local item_exceptions = {2152, 2160, 5792, 5793, 5794, 5795, 5796, 5797}
   
    -- add this after function Player:onMoveItem
    if not isInArray(item_exceptions, item.itemid) and toPosition.x == 1527 and toPosition.y == 1152 and toPosition.z == 7 then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end
I think it should be
LUA:
function antiTrasher.onAddItem(moveitem, tileitem, position)
thanks but it didn't worked either, so I just deleted the script and added the following lines to onMove player event and it worked, thanks for the help tho, here is the code in case anyone wants:

LUA:
    -- add this at the top of the file
    local item_exceptions = {2152, 2160, 5792, 5793, 5794, 5795, 5796, 5797}
   
    -- add this after function Player:onMoveItem
    if not isInArray(item_exceptions, item.itemid) and toPosition.x == 1527 and toPosition.y == 1152 and toPosition.z == 7 then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end
 
Solution
thanks but it didn't worked either, so I just deleted the script and added the following lines to onMove player event and it worked, thanks for the help tho, here is the code in case anyone wants:

LUA:
    -- add this at the top of the file
    local item_exceptions = {2152, 2160, 5792, 5793, 5794, 5795, 5796, 5797}
  
    -- add this after function Player:onMoveItem
    if not isInArray(item_exceptions, item.itemid) and toPosition.x == 1527 and toPosition.y == 1152 and toPosition.z == 7 then
        self:sendCancelMessage(RETURNVALUE_NOTPOSSIBLE)
        return false
    end
Did you check if it even executes the function at all?
 
Back
Top