Hello, I want to prevent put items on teleport and I have this script:
When I was testing this script everything was ok - when item is put on the teleport then item disappers and is created in backpack of player who had thrown it.
But... sometimes I have this error:
It means that thrown item is not removed. In this situation - is item given to player? or script ends?
If item is not removed and is given to player that player has 2 items... :/
Maybe there can be done something like this - check if the item is removed, if not than do not make doPlayerAddItem?
Code:
function onAddItem(moveitem, tileitem, position, cid)
doRemoveItem(moveitem.uid)
doPlayerSendCancel(cid, "You may not throw items here.") -- Sends cancel message
if(doPlayerAddItemEx(cid, doCreateItemEx(moveitem.itemid, moveitem.type)) == RETURNVALUE_NOERROR) then
return true
end
return true
end
When I was testing this script everything was ok - when item is put on the teleport then item disappers and is created in backpack of player who had thrown it.
But... sometimes I have this error:
Code:
[Error - MoveEvents Interface]
data/movements/scripts/no_add.lua:onAddItem
Description:
(luaDoRemoveItem) Item not found
It means that thrown item is not removed. In this situation - is item given to player? or script ends?
If item is not removed and is given to player that player has 2 items... :/
Maybe there can be done something like this - check if the item is removed, if not than do not make doPlayerAddItem?