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

[Help] - Wont teleport

Ozo

New Member
Joined
Jun 30, 2008
Messages
58
Reaction score
0
hello, i want my script to teleport me when i'm at a certain position:
PHP:
function onUse(cid, item, frompos, item2, topos)

player1Pos = {x=581, y=581, z=13, stackpos=255}
player1 = getThingfromPos(player1Pos)
telPos = {x=581, y=581, z=14, stackpos=255}
	
	if item.itemid == 1945 then
		doTransformItem(item.uid,item.itemid+1)
		doTeleportThing(player1,telPos)
	elseif item.itemid == 1946 then
		doTransformItem(item.uid,item.itemid-1)
	end
return TRUE
end

Error:
Code:
Lua Script Error: [Action Interface]
data/actions/scripts/quests/minianni.lua:onUse

luaDoTeleportThing(). Thing not found

Any ideas? :eek:
 
Code:
function onUse(cid, item, frompos, item2, topos)

tilepos = {x=581, y=581, z=13}
telPos = {x=581, y=581, z=14}

    if item.itemid == 1945 and getCreaturePosition(cid) == tilepos then
        doTransformItem(item.uid,item.itemid+1)
        doTeleportThing(cid,telPos)
    elseif item.itemid == 1946 then
        doTransformItem(item.uid,item.itemid-1)
    end
return TRUE
end

that should work
 
Code:
function onUse(cid, item, frompos, item2, topos)

tilepos = {x=581, y=581, z=13}
telPos = {x=581, y=581, z=14}
pos = getCreaturePosition(cid)
    if item.itemid == 1945 and comparePos(pos,tilepos) == TRUE then
        doTransformItem(item.uid,item.itemid+1)
        doTeleportThing(cid,telPos)
    elseif item.itemid == 1946 then
        doTransformItem(item.uid,item.itemid-1)
    end
return TRUE
end

dunno, never used that function, dont know how to count it. im guessing true will work
 
Code:
attempt to call global 'comparePos' (a nil value)

Do i need to declare a function for this in global.lua?
 
Yes, but I thought everyone had it:
PHP:
function comparePos(pos1, pos2)
    return (pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z)
end
 
Cool it works! wooho! thanks :)
Now, to the next step, how can i make it check if there are 2 players standing on the right co-ordinates and teleport them both?
 
Back
Top