• 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!
  • 2026 staff recruitment is open! Check it out and consider applying!

Solved Lever Teleport (Script) 0.3.6

Rider Ones

New Member
Joined
Jan 12, 2009
Messages
104
Reaction score
2
A lever that teleport you to another place just a unique id, level not need to use it, it is an elevator like Farmine, I explained well? Being used, regards
 
Does the player need to be standing on a specific tile?

If not:

Code:
local destination = {x=32369, y=32239, z=7}    -- Change your destination here.

function onUse(cid, item, fromPosition, itemEx, toPosition)
    doTeleportThing(cid, destination, false)
    doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
return true
end

actions.xml
Code:
<action uniqueid="9023" event="script" value="testLever.lua"/>
 
Does the player need to be standing on a specific tile?

If not:

Code:
local destination = {x=32369, y=32239, z=7}    -- Change your destination here.

function onUse(cid, item, fromPosition, itemEx, toPosition)
    doTeleportThing(cid, destination, false)
    doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
    doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)
return true
end

actions.xml
Code:
<action uniqueid="9023" event="script" value="testLever.lua"/>
yes if you can do it please
 
I didn't test this but you can try it out

Code:
local destination = {x=32369, y=32239, z=7}    -- Change your destination here.
local tilePos = {x = 0, y = 0, z = 0} -- change this to the position of the tile

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerPosition(cid) == tilePos then
        doTeleportThing(cid, destination, false)
        doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
        doSendMagicEffect(tilePos, CONST_ME_TELEPORT)
    else
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
return true
end
 
I didn't test this but you can try it out

Code:
local destination = {x=32369, y=32239, z=7}    -- Change your destination here.
local tilePos = {x = 0, y = 0, z = 0} -- change this to the position of the tile

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerPosition(cid) == tilePos then
        doTeleportThing(cid, destination, false)
        doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
        doSendMagicEffect(tilePos, CONST_ME_TELEPORT)
    else
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
return true
end
When i use the lever, i only get POFF and not teleport to destination,
 
Code:
local destination = Position(32369, 32239, 7)     -- Change your destination here.
local tilePos = Position(0, 0, 0)                -- Change tile position here.

function onUse(cid, item, fromPosition, itemEx, toPosition)
    if getPlayerPosition(cid) == tilePos then
        doTeleportThing(cid, destination, false)
        doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
        doSendMagicEffect(tilePos, CONST_ME_TELEPORT)
    else
        doSendMagicEffect(getPlayerPosition(cid), CONST_ME_POFF)
    end
    return true
end
 
If the person on the tile must be the one who pulls the lever:
Code:
local destination = {x=32369, y=32239, z=7}    -- Change your destination here.
local stand = {x=32364, y=32240, z=7} -- tile where player must stand

function onUse(cid, item, fromPosition, itemEx, toPosition)

local creature = getTopCreature(stand).uid

if not creature or not isPlayer(creature) then     
    doPlayerSendCancel(cid, "Please stand on the tile first.")
    return true
end

if getPlayerGUID(creature) ~= getPlayerGUID(cid) then
    doPlayerSendCancel(cid, "Please stand on the tile first.")
    return true
end

doTeleportThing(cid, destination, false)
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)

return true
end



If it doesn't matter who pulls the lever as long as there is a person on the tile:
Code:
local destination = {x=32369, y=32239, z=7}    -- Change your destination here.
local stand = {x=32363, y=32235, z=6} -- tile where player must stand

function onUse(cid, item, fromPosition, itemEx, toPosition)

local creature = getTopCreature(stand).uid

if not creature or not isPlayer(creature) then      
    doPlayerSendCancel(cid, "A player must stand on the tile first.")
    return true
end


doTeleportThing(creature, destination, false)
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
doSendMagicEffect(getPlayerPosition(creature), CONST_ME_TELEPORT)

return true
end
 
Last edited:
If the person on the tile must be the one who pulls the lever:
Code:
local destination = {x=32369, y=32239, z=7}    -- Change your destination here.
local stand = {x=32364, y=32240, z=7} -- tile where player must stand

function onUse(cid, item, fromPosition, itemEx, toPosition)

local creature = getTopCreature(stand).uid

if not creature or not isPlayer(creature) then    
    doPlayerSendCancel(cid, "Please stand on the tile first.")
    return true
end

if getPlayerGUID(creature) ~= getPlayerGUID(cid) then
    doPlayerSendCancel(cid, "Please stand on the tile first.")
    return true
end

doTeleportThing(cid, destination, false)
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
doSendMagicEffect(getPlayerPosition(cid), CONST_ME_TELEPORT)

return true
end



If it doesn't matter who pulls the lever as long as there is a person on the tile:
Code:
local destination = {x=32369, y=32239, z=7}    -- Change your destination here.
local stand = {x=32363, y=32235, z=6} -- tile where player must stand

function onUse(cid, item, fromPosition, itemEx, toPosition)

local creature = getTopCreature(stand).uid

if not creature or not isPlayer(creature) then     
    doPlayerSendCancel(cid, "A player must stand on the tile first.")
    return true
end


doTeleportThing(creature, destination, false)
doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
doSendMagicEffect(getPlayerPosition(creature), CONST_ME_TELEPORT)

return true
end

Thank you too much, it works!! rep+
 
Back
Top