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

Whats wrong with my teleport code?

Zerity

New Member
Joined
Jul 7, 2009
Messages
89
Reaction score
0
this is gonna work like this " you put soul orb on coal basin , stand on the gray platform and pull the lever to get to the other side of the stone" but it is like this now
you put soul orb on the coal basin standing in the gray platform pulling the lever but nothings happening.
read more down :) please

it looks like this on the map
2uorm6h.jpg


and here is the code

local config = {
tpPos = {x = 307, y = 61, z = 9},
pPos = {x = 305, y = 61, z = 9, stackpos = 253}, -- dont touch the stackpos
itemPos = {x = 304, y = 61, z = 9, stackpos = 1},
itemId = 5944
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local getItem = getTileThingByPos(config.itemPos)
local getPlayer = getThingFromPos(pPos)
if getPlayer.config.itemid == TRUE then
if getItem.config.itemid == config.itemId then
doRemoveItem(getItem.uid, 1)
doSendMagicEffect(getPlayer.uid, CONST_ME_POFF)
doTeleportThing(cid, config.tpPos)
doSendMagicEffect(config.tpPos, 37)
else
doPlayerSendCancel(cid, "You have to stay on the right position and put the "..getItemNameById(config.itemId).." on the coal basin")
end
end
return TRUE
end
<action uniqueid="1238" script="tele.lua" />

try find out whats wrong with it please.
when i put the soul orb on the coal basin and pulling the lever nothing happends i get this error in " Console "
[16/07/2009 00:12:58] Lua Script Error: [Action Interface]
[16/07/2009 00:12:58] data/actions/scripts/tele.lua:onUse

[16/07/2009 00:12:58] data/actions/scripts/tele.lua:10: attempt to call global 'getThingFromPos' (a nil value)
[16/07/2009 00:12:58] stack traceback:
[16/07/2009 00:12:58] data/actions/scripts/tele.lua:10: in function <data/actions/scripts/tele.lua:8>
 
Change
LUA:
if getPlayer.config.itemid == TRUE then
if getItem.config.itemid == config.itemId then

To
LUA:
if getPlayer.itemid > 0 then
if getItem.itemid == config.itemid then

And change
LUA:
doSendMagicEffect(getPlayer.uid, CONST_ME_POFF)

To
LUA:
doSendMagicEffect(pPos, CONST_ME_POFF)
 
Not Tested - Should Work

LUA:
local config = 
{
    newPos = {x=307, y=61, z=9}, -- New Position
    tilePos = {x=305, y=61, z=9}, -- Tile Position
    itemPos = {x=304, y=61, z=9} -- Item Pos
}

function onUse(cid, item, fromPosition, itemEx, toPosition)
local item_id = XXXX -- Item
local playerPos = getCreaturePosition(cid)
local getItem = getTileItemById(cid)
    if (playerPos == config.tilePos) then
        if getItem(config.itemPos, item_id) == TRUE then
	    doRemoveItem(getItem.uid, 1)
	    doSendMagicEffect(playerPos, CONST_ME_POFF)
	    doTeleportThing(cid, config.newPos)
	    doSendMagicEffect(config.tilePos, 37)
	else
	    doPlayerSendCancel(cid, "You have to stay on the right position and put the "..getItemNameById(item_id).." on the coal basin")
	end
        return TRUE
    end
end
 
Last edited:
Back
Top