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

Tp when use item, teleport if correct pos

Tofflarn

New Member
Joined
Mar 22, 2008
Messages
360
Reaction score
1
Location
Sweden
Hello again, i need some help with a script :)

This is how it should work..

1. Players is going to move a lever(it should have actionid 4830) to get teleported.
2. To do this he need to stand on a specific sqm (tile)
3. If not send a message it can't be done..

This is what i got, totally shity script. Im learing so please understand ;)

Code:
local config = {
playertile = {x=32991,y=31539,z=1},
newpos1 = {x=32991,y=31539,z=4}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)


	if (item.actionid == 4830) and getCreaturePosition(config.playertile) then
			doTeleportThing(cid,config.newpos1) 
			else
     doCreatureSay(cid, "test wrong", TALKTYPE_ORANGE_1)
	end
	return true

end

And as you might understand i don't work so please tell me what should i do and what did i wrong?
 
Try this: Not sure if it will work
Credits: SexyDevil, Me, changing few lines xp


Lua:
function onUse(cid, item, fromPosition, itemEx, topos)
local PlayerPosition = {x = 32991, y = 31539, z = 1}
local newPosition = {x = 32991, y = 31539, z = 4}
	if item.uid == 4830 and item.itemid == 1945 then
	    doSendMagicEffect(getThingPos(cid), CONST_ME_POOF)
		doTeleportThing(cid, newPosition, TRUE)
		doSendMagicEffect(getThingPos(cid), CONST_ME_TELEPORT)
	end
	return doTransformItem(item.uid, item.itemid == 1945 and 1946 or 1945)
end
 
Back
Top