• 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 Make item "Not Moveable" in lua.

LuisPro

World War <3
Joined
May 10, 2009
Messages
425
Solutions
1
Reaction score
53
If i want make some item "not moveable" i can do it in otitemeditor.
I know this.

My question is how to do this in lua?
[tfs 1.2]
 
Solution
for example i want to make ~50 items not moveable i have to add every one in actions.xml?
like: <action itemid="2500" script="notmoveable.lua"/> x50 for every item?
no, i said player events not actions
just make an array with item ids and use isInArray(array, item:getId()) then return false
player events
function Player:eek:nMoveItem

something like if item:getId() == xxxx then return false end
 
player events
function Player:eek:nMoveItem

something like if item:getId() == xxxx then return false end
for example i want to make ~50 items not moveable i have to add every one in actions.xml?
like: <action itemid="2500" script="notmoveable.lua"/> x50 for every item?
 
make the items untradeable as well.
Also remove use with option.
 
for example i want to make ~50 items not moveable i have to add every one in actions.xml?
like: <action itemid="2500" script="notmoveable.lua"/> x50 for every item?
no, i said player events not actions
just make an array with item ids and use isInArray(array, item:getId()) then return false
 
Solution
have this code replaced in data/events/players.lua the script works but items can be trade, how do i block that function?
Lua:
--function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder)
--    if hasEventCallback(EVENT_CALLBACK_ONMOVEITEM) then
--        return EventCallback(EVENT_CALLBACK_ONMOVEITEM, self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
--    end
--    return true
--end
function Player:onMoveItem(item, count, fromPosition, toPosition, fromCylinder, toCylinder) 
   if item.actionid == 9502 then
     self:sendCancelMessage('You cannot move this object.')
     return false
   end
   return true
end
 
Back
Top