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

lever change tp postion

Tofflarn

New Member
Joined
Mar 22, 2008
Messages
360
Reaction score
1
Location
Sweden
Hello dear otlanders! :)

I need some help with a script!
Been trying by myself without any improvements!

I request a script that change the position of a teleport when players pull a lever.. And if the player pull the lever back the tp change back to its original postion..

Another exempel :)
1 Player pull the lever.
2 The teleport change postion to x1 y2 z3
3 Player pull the teleport back
4 The teleport return to origianl tp postion..

Thx in advanced :)
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local config = {
			firstTeleportPos = {x=111, y=111, z=7, stackpos=1},
			secondTeleportPos = {x=112, y=111, z=7, stackpos=1},
			teleportToPos = {x=500, y=500, z=7} -- Where the player should be teleported
			}
	
	if getTileItemById(config.firstTeleportPos, 1387) then
		doRemoveItem(getThingFromPos(config.firstTeleportPos).uid, 1)
		doCreateTeleport(1387, config.teleportToPos, config.secondTeleportPos)
	elseif getTileItemById(config.secondTeleportPos, 1387) then
		doRemoveItem(getThingFromPos(config.secondTeleportPos).uid, 1)
		doCreateTeleport(1387, config.teleportToPos, config.firstTeleportPos)
	end
return true
end
 
Code:
local t = {
	portalPos = {x=100, y=100, z=7},
	posLeft = {x=100, y=100, z=7},
	posRight = {x=100, y=100, z=7}
}
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local k = item.itemid == 1945
	doRemoveItem(getTileItemById(t.portalPos, 1387).uid)
	doCreateTeleport(1387, k and t.posRight or t.posLeft, t.portalPos)
	doTransformItem(item.uid, k and 1946 or 1945)
	return TRUE
end
 
ohh Thank you guys! Can you tell me what i should write in action.xml? :)


EDIT: no need for that! I use Cykotitan script, works awesome! Im sure Sypher works to but i belive Cykotitan was easier for me :)

Rep for yaa guys ++
 
Last edited:
Back
Top