• 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 remove item

ImaG

Active Member
Joined
Aug 16, 2017
Messages
75
Solutions
1
Reaction score
36
Location
Poland
GitHub
ImaGus01v
Hello i have a problem.
When an item is in the backpack, it disappears.
When an item is on the ground, it disappears.
When it's in the browse box... I can click on it at will and it doesn't disappear.
How to fix it?
Screenshot:
w1il8iq.png

Lua:
function onUse(player, item, fromPosition, target, toPosition, isHotkey)
  local itemId = item:getId()


  if itemId == 16102 then

    player:getPosition():sendMagicEffect(CONST_ME_MAGIC_BLUE)


    addEvent(function()

      local monster = Game.createMonster("Chicken", player:getPosition())

      player:removeItem(itemId, 1)
      player:sendTextMessage(MESSAGE_INFO_DESCR, "!")
      
      local tile = Tile(toPosition)
      if tile then
        local items = tile:getItems()
        for i = 1, #items do
          local groundItem = items[i]
          if groundItem:getId() == itemId then
            groundItem:remove(1)
            break
          end
        end
      end
    end, 1500)
  end
end
 
Back
Top