• 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!

Teleport if have item on backpack.

claumann

New Member
Joined
Oct 12, 2010
Messages
1
Reaction score
0
I need a script to player only can enter in teleport if he have a item in backpack. After takes the item and pass in the teleport he wins acess to this teleport all time. (and loose the item)


This is like Deeper Banuta Shortcut, in global tibia need one egg of the many
 
if player:getItemCount(itemid) > 0 then
player:setStorageValue(key, 1)
end

if player:getStorageValue(key) == 1 then
teleport
end

edit:
also read the board rules before posting
 
You'd also want to remove the item. :rolleyes:
But yes, please read board rules prior to posting.
It helps us, help you, help us all.

My version of the script for 0.3.7
Place the ActionID on the floor, beneath the teleport. Teleport has 0,0,0 for co-ordinates. Set teleport position inside script only.
Code:
<movevent type="StepIn" actionid="11111" event="script" value="script_name.lua"/>
Code:
local storage = 11111
local item_required = 11111 -- item_id
local teleport_to = {x = 11111, y = 11111, z = 11}

function onStepIn(cid, item, position, fromPosition)

    if not isPlayer(cid) then
        return false
    end

    local tp = 0
    if getPlayerStorageValue(cid, storage) == 1 then
        tp = 1
    elseif getPlayerItemCount(cid, item_required) >= 1 then
        doPlayerRemoveItem(cid, item_required, 1)
        setPlayerStorageValue(cid, storage, 1)
        tp = 1
    end

    if tp == 1 then
        doTeleportThing(cid, teleport_to)
    else
        doTeleportThing(cid, fromPosition)
        doPlayerSendCancel(cid, "Quest completion required! Egg of the Many needs to be in player possession when accessing the portal!")
    end

    return true
end
 
Back
Top