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

Solved onMove Event script Help

Status
Not open for further replies.

Sigoles

Discord: @sigoles
Joined
Nov 20, 2015
Messages
1,209
Solutions
2
Reaction score
154
Hello I'm trying to do just to move money inside pouch.

code onMove:
Code:
if not isInArray({2148, 2160, 2152}, item.itemid) and toCylinder:getId() == 26402 then
        self:sendCancelMessage('Sorry, only money can be saved inside pouch.')
        return false
    end


Look example:
NbANITz.png

I can move itens on 1 (wrong)
I can't move itens on 2 (its ok)
 
put this under your code.

post your onMove event so I can make sure this is right.

Code:
if not isInArray({2148, 2160, 2152}, item.itemid) and toItem.itemid == 26402 then
       self:sendCancelMessage('Sorry, only money can be saved inside pouch.')
        return false
    end
 
thanks, but Dont working yet

Code:
function Player:onMoveItem(item, count, fromPosition, toPosition, toItem, fromCylinder, toCylinder)

if not isInArray({2148, 2160, 2152}, item.itemid) and toItem.itemid == 26402 then
       self:sendCancelMessage('Sorry, only money can be saved inside pouch.')
        return false
    end
 
Try it like this

Code:
if not isInArray({2148, 2160, 2152}, item.itemid) then 
    if toCylinder:getId() == 26402 then
        self:sendCancelMessage('Sorry, only money can be saved inside pouch.')
        return false
    end
    if toItem.itemid == 26402 then
        self:sendCancelMessage('Sorry, only money can be saved inside pouch.')
        return false
    end
end
 
@Itutorial

I got a error hhmmm

Code:
Lua Script Error: [Event Interface]
data/events/scripts/player.lua:Player@onMoveItem
data/events/scripts/player.lua:248: attempt to index local 'toCylinder' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/events/scripts/player.lua:248: in function <data/events/scripts/player.lua:245>
 
@Itutorial

I got a error hhmmm

Code:
Lua Script Error: [Event Interface]
data/events/scripts/player.lua:Player@onMoveItem
data/events/scripts/player.lua:248: attempt to index local 'toCylinder' (a nil value)
stack traceback:
        [C]: in function '__index'
        data/events/scripts/player.lua:248: in function <data/events/scripts/player.lua:245>
where did you get your function from?
you can't just throw argument into a function like that and expect it to work.
 
where did you get your function from?
you can't just throw argument into a function like that and expect it to work.

Events/player.lua

Code:
function Player:onMoveItem(item, count, fromPosition, toPosition, toItem, fromItem, fromCylinder, toCylinder)

    if not isInArray({2148, 2160, 2152}, item.itemid) then
    if toCylinder:getId() == 26402 then
        self:sendCancelMessage('Sorry, only money can be saved inside pouch.')
        return false
    end
    if toItem.itemid == 26402 then
        self:sendCancelMessage('Sorry, only money can be saved inside pouch.')
        return false
    end
end

return true
end
 
Events/player.lua

Code:
function Player:onMoveItem(item, count, fromPosition, toPosition, toItem, fromItem, fromCylinder, toCylinder)

    if not isInArray({2148, 2160, 2152}, item.itemid) then
    if toCylinder:getId() == 26402 then
        self:sendCancelMessage('Sorry, only money can be saved inside pouch.')
        return false
    end
    if toItem.itemid == 26402 then
        self:sendCancelMessage('Sorry, only money can be saved inside pouch.')
        return false
    end
end

return true
end
count, toItem, fromItem, fromCylinder and toCylinder dont exist in the moveitem function.
 
count, toItem, fromItem, fromCylinder and toCylinder dont exist in the moveitem function.
It does not exist if you have not updated your tfs ..but anyway, I continue to doubt how to block the move items into the container.
 
Status
Not open for further replies.
Back
Top