unknownuser
Member
- Joined
- Apr 2, 2015
- Messages
- 44
- Reaction score
- 12
Hi,
when I try to unwrap item it's just dissapear. It's working fine when item is set to not store item and can be put on the floor but when I try do this from storeInbox it just dissapears.
OnWarp function:
I created item in below way:
When I set playerItem:setStoreItem to false I can move item on floor and warp is working but then I cannot put it back to storeInbox. I'm sure that the issue is with creation of item by: local item = tile:addItem(wrapId).
when I try to unwrap item it's just dissapear. It's working fine when item is set to not store item and can be put on the floor but when I try do this from storeInbox it just dissapears.
OnWarp function:
function PlayernWrapItem(item)
local topCylinder = item:getTopParent()
if not topCylinder then
return
end
local tile = Tile(topCylinder:getPosition())
if not tile then
return
end
local house = tile:getHouse()
if not house then
self:sendCancelMessage("You can only wrap and unwrap this item inside a house.")
return
end
if house ~= self:getHouse() and not string.find(house:getAccessList(SUBOWNER_LIST):lower(), "%f[%a]" .. self:getName():lower() .. "%f[%A]") then
self:sendCancelMessage("You cannot wrap or unwrap items from a house, which you are only guest to.")
return
end
local wrapId = item:getAttribute("wrapid")
if wrapId == 0 then
return
end
if not hasEventCallback(EVENT_CALLBACK_ONWRAPITEM) or EventCallback(EVENT_CALLBACK_ONWRAPITEM, self, item) then
local oldId = item:getId()
item:remove(1)
local item = tile:addItem(wrapId)
if item then
item:setAttribute("wrapid", oldId)
end
end
end
I created item in below way:
local player = Player(cid)
local playerItem = Game.createItem(26129, 1)
playerItem:setAttribute("wrapid", 26347)
playerItem:setAttribute(ITEM_ATTRIBUTE_DESCRIPTION, 'It contains ' .. playerItem:getName() .. '.')
local storeInbox = player:getStoreInbox()
playerItem:moveTo(storeInbox)
playerItem:setStoreItem(true)
When I set playerItem:setStoreItem to false I can move item on floor and warp is working but then I cannot put it back to storeInbox. I'm sure that the issue is with creation of item by: local item = tile:addItem(wrapId).