Follow along with the video below to see how to install our site as a web app on your home screen.
Note: This feature may not be available in some browsers.
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!
local items = {13537, 2152}
local ec = EventCallback
ec.onMoveItem = function(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
local tile = Tile(fromPosition)
local tile2 = Tile(toPosition)
if tile then
if tile:getHouse() then
if tile2 then
if not tile2:getHouse() then
if table.contains(items, item:getId()) then
self:sendTextMessage(MESSAGE_INFO_DESCR, 'Sorry, but you can not move this out of your house.')
return false
end
end
end
end
end
return true
end
ec:register()
Action id 2000 on item
you can change it to any actionid u want
Oh I think I understand it wrong
it should not be pushed out of house only right?
local ec = EventCallback
ec.onMoveItem = function(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
if item:getActionId() == 2000 then
self:sendTextMessage(MESSAGE_INFO_DESCR, 'Sorry, but you can not move this item.')
return false
end
return true
end
ec:register()
Action id 2000 on item
you can change it to any actionid u want
Oh I think I understand it wrong
it should not be pushed out of house only right?
To be honest
Im not sure what would be the best solution for that
sry
this one is a example how to avoid people moving out items from house
Lua:
local items = {13537, 2152}
local ec = EventCallback
ec.onMoveItem = function(self, item, count, fromPosition, toPosition, fromCylinder, toCylinder)
local tile = Tile(toPosition)
if tile then
if not tile:getHouse() then
if table.contains(items, item:getId()) then
self:sendTextMessage(MESSAGE_INFO_DESCR, 'Sorry, but you can not move this out of your house.')
return false
end
end
end
return true
end
ec:register()
That way it allowed it to move in and prevented it from moving out, but when trying to drag it out it gives this error in the distro.
Lua Script Error: [Event Interface]
data/events/scripts/player.luaPlayer@onMoveItem
data/global.lua:178: bad argument #1 to 'pairs' (table expected, got nil)
stack traceback:
[C]: at 0x7ff6a688bb90
[C]: in function 'pairs'
data/global.lua:178: in function 'contains'
...ata\scripts\eventcallbacks\player\default_onMoveItem.lua:110: in function <...ata\scripts\eventcallbacks\player\default_onMoveItem.lua:30>
C:\server\data\scripts/lib\event_callbacks.lua:129: in function <C:\server\data\scripts/lib\event_callbacks.lua:125>