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
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
<action uniqueid="9023" event="script" value="testLever.lua"/>
yes if you can do it pleaseDoes 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"/>
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,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
Did you set the correct tile pos?When i use the lever, i only get POFF and not teleport to destination,
Yes its correct u,uDid you set the correct tile pos?
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
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
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
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