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

RevScripts Click to pass

adrenyslopez

Member
Joined
Dec 22, 2015
Messages
201
Reaction score
15
Hello, this time I need help if someone has a revscript that when you touch (in this case a tree) will transport you to a place and if you touch it again it will return you, I will leave some example photos and a video of how it should work

And apart from asking you for level 200 to click and pass and return

By clicking it, I transport you 1 sqm forward
pass.png

And when you click, I will return you again
pass2.png

Let it be something like this door that is located in Hive of gray island

i used otbr tfs 1.3
 
Solution
Lua:
local config = {
    minLevel = 200,
    firstPosition = Position(100, 100, 7),
    secondPosition = Position(100, 100, 7)
}

local treePass = Action();

function treePass.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() >= config.minLevel then
        if player:getPosition().y == config.secondPosition.y then
            player:teleportTo(config.firstPosition)
        else
            player:teleportTo(config.secondPosition)
        end
    end
    return true
end

treePass:aid(3000)
treePass:register()
Lua:
local config = {
    minLevel = 200,
    firstPosition = Position(100, 100, 7),
    secondPosition = Position(100, 100, 7)
}

local treePass = Action();

function treePass.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() >= config.minLevel then
        if player:getPosition().y == config.secondPosition.y then
            player:teleportTo(config.firstPosition)
        else
            player:teleportTo(config.secondPosition)
        end
    end
    return true
end

treePass:aid(3000)
treePass:register()
 
Solution
Lua:
local config = {
    minLevel = 200,
    firstPosition = Position(100, 100, 7),
    secondPosition = Position(100, 100, 7)
}

local treePass = Action();

function treePass.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() >= config.minLevel then
        if player:getPosition().y == config.secondPosition.y then
            player:teleportTo(config.firstPosition)
        else
            player:teleportTo(config.secondPosition)
        end
    end
    return true
end

treePass:aid(3000)
treePass:register()
Is it possible that he gives a message when he does not let you go through the lvl?
 
Is it possible that he gives a message when he does not let you go through the lvl?
Try this:
Lua:
local config = {
    minLevel = 200,
    firstPosition = Position(100, 100, 7),
    secondPosition = Position(100, 100, 7)
}

local treePass = Action();

function treePass.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() >= config.minLevel then
        if player:getPosition().y == config.secondPosition.y then
            player:teleportTo(config.firstPosition)
        else
            player:teleportTo(config.secondPosition)
        end
    else
   player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your level is too small. You need to be at least 200 level.")
    end
    return true
end

treePass:aid(3000)
treePass:register()
 
Last edited:
Try this:
Lua:
local config = {
    minLevel = 200,
    firstPosition = Position(100, 100, 7),
    secondPosition = Position(100, 100, 7)
}

local treePass = Action();

function treePass.onUse(player, item, fromPosition, target, toPosition, isHotkey)
    if player:getLevel() >= config.minLevel then
        if player:getPosition().y == config.secondPosition.y then
            player:teleportTo(config.firstPosition)
        else
            player:teleportTo(config.secondPosition)
        end
    else
   player:sendTextMessage(MESSAGE_EVENT_ADVANCE, "Your level is too small. You need to be at least "..minLevel.." .")
    end
    return true
end

treePass:aid(3000)
treePass:register()

Code:
Lua Script Error: [Scripts Interface]
/home/forgottenserver/data/scripts/actions/quests/warzone_789/wz_access.lua:callback
...er/data/scripts/actions/quests/warzone_789/wz_access.lua:17: attempt to concatenate global 'minLevel' (a nil value)
stack traceback:
        [C]: in function '__concat'
        ...er/data/scripts/actions/quests/warzone_789/wz_access.lua:17: in function <...er/data/scripts/actions/quests/warzone_789/wz_access.lua:9>
 
Code:
Lua Script Error: [Scripts Interface]
/home/forgottenserver/data/scripts/actions/quests/warzone_789/wz_access.lua:callback
...er/data/scripts/actions/quests/warzone_789/wz_access.lua:17: attempt to concatenate global 'minLevel' (a nil value)
stack traceback:
        [C]: in function '__concat'
        ...er/data/scripts/actions/quests/warzone_789/wz_access.lua:17: in function <...er/data/scripts/actions/quests/warzone_789/wz_access.lua:9>
edited already. try now
 
Back
Top