TOOLS.ROPE = function(cid, item, fromPosition, itemEx, toPosition)
if(toPosition.x == CONTAINER_POSITION) then
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
return true
end
toPosition.stackpos = STACKPOS_GROUND
errors(false)
local ground = getThingFromPos(toPosition)
errors(true)
if(isInArray(SPOTS, ground.itemid)) then
local hole = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
if( ( isPlayer(hole.uid) and ( not isPlayerGhost(hole.uid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(hole.uid) ) ) or hole.itemid > 0 ) then
return false
else
doTeleportThing(cid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z - 1}, false)
return true
end
elseif(isInArray(ROPABLE, itemEx.itemid)) then
local canOnlyRopePlayers = getBooleanFromString(getConfigValue('canOnlyRopePlayers'))
local hole = getThingFromPos({x = toPosition.x, y = toPosition.y, z = toPosition.z + 1, stackpos = STACKPOS_TOP_MOVEABLE_ITEM_OR_CREATURE})
if(canOnlyRopePlayers) then
if(isPlayer(hole.uid) and (not isPlayerGhost(hole.uid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(hole.uid))) then
doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
else
if(hole.itemid > 0) then
doTeleportThing(hole.uid, {x = toPosition.x, y = toPosition.y + 1, z = toPosition.z}, false)
else
doPlayerSendDefaultCancel(cid, RETURNVALUE_NOTPOSSIBLE)
end
end
return true
end
return false
end