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

Door teleport help (Easy Script help)

merfus

Member
Joined
Dec 27, 2011
Messages
214
Reaction score
5
Location
Poland
i got script for door:

PHP:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if (item.actionid == 5788 and getPlayerStorageValue(cid,63111) >= 1) then
		doTeleportThing(cid, {x=toPosition.x-1,y=toPosition.y,z=toPosition.z}, TRUE)
		doCreatureSay(cid, "You can Pass Survival Door.", TALKTYPE_ORANGE_1)
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot pass this Survival Door.")
	end
	return true
end

But when i go into door i am in wall near the door

i try to change that:
PHP:
		doTeleportThing(cid, {x=toPosition.x-1,y=toPosition.y,z=toPosition.z}, TRUE)
to that:
PHP:
		doTeleportThing(cid, {x=toPosition.x,y=toPosition.y-1,z=toPosition.z}, TRUE)
but now i can go with that door only with one side
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 63111) >= 1 then
		if (getCreaturePosition(cid).y < getThingPos(item.uid).y) then
			doTeleportThing(cid, getThingPos(item.uid).y+1)
		else
			doTeleportThing(cid, getThingPos(item.uid).y-1)
		end
		doCreatureSay(cid, "You can Pass Survival Door.", TALKTYPE_ORANGE_1) 
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot pass this Survival Door.")
	end
return TRUE
end
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 63111) >= 1 then
		if (getCreaturePosition(cid).y < getThingPos(item.uid).y) then
			doTeleportThing(cid, getThingPos(item.uid).y+1)
		else
			doTeleportThing(cid, getThingPos(item.uid).y-1)
		end
		doCreatureSay(cid, "You can Pass Survival Door.", TALKTYPE_ORANGE_1) 
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot pass this Survival Door.")
	end
return TRUE
end

Still the same, im in door (the same tile what door)
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 63111) >= 1 then
		if (getCreaturePosition(cid).y < getThingPos(item.uid).y) then
			doTeleportThing(cid, {x=getCreaturePosition(cid).x, y=getThingPos(item.uid).y+1, z=getCreaturePosition(cid).z})
		else
			doTeleportThing(cid, {x=getCreaturePosition(cid).x, y=getThingPos(item.uid).y-1, z=getCreaturePosition(cid).z})
		end
		doCreatureSay(cid, "You can Pass Survival Door.", TALKTYPE_ORANGE_1) 
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot pass this Survival Door.")
	end
return TRUE
end
my bad
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, 63111) >= 1 then
		if (getCreaturePosition(cid).y < getThingPos(item.uid).y) then
			doTeleportThing(cid, {x=getCreaturePosition(cid).x, y=getThingPos(item.uid).y+1, z=getCreaturePosition(cid).z})
		else
			doTeleportThing(cid, {x=getCreaturePosition(cid).x, y=getThingPos(item.uid).y-1, z=getCreaturePosition(cid).z})
		end
		doCreatureSay(cid, "You can Pass Survival Door.", TALKTYPE_ORANGE_1) 
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot pass this Survival Door.")
	end
return TRUE
end
my bad

Still in door ;(
 
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid,63111) >= 1 then
		if (getCreaturePosition(cid).x < getThingPos(item.uid).x) then
			doTeleportThing(cid, {x=getThingPos(item.uid).x+1, y=getThingPos(item.uid).y, z=getThingPos(item.uid).z})
		else
			doTeleportThing(cid, {x=getThingPos(item.uid).x-1, y=getThingPos(item.uid).y, z=getThingPos(item.uid).z})
		end
		doCreatureSay(cid, "You can Pass Survival Door.", TALKTYPE_ORANGE_1) 
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You cannot pass this Survival Door.")
	end
return TRUE
end
 
LUA:
function onuse(cid, item, fromposition, itemex, toposition)
	if getplayerstoragevalue(cid,63111) >= 1 then
		if (getcreatureposition(cid).x < getthingpos(item.uid).x) then
			doteleportthing(cid, {x=getthingpos(item.uid).x+1, y=getthingpos(item.uid).y, z=getthingpos(item.uid).z})
		else
			doteleportthing(cid, {x=getthingpos(item.uid).x-1, y=getthingpos(item.uid).y, z=getthingpos(item.uid).z})
		end
		docreaturesay(cid, "you can pass survival door.", talktype_orange_1) 
	else
		doplayersendtextmessage(cid, message_info_descr, "you cannot pass this survival door.")
	end
return true
end

works! Thx dude!
 
You should use this one so you can use it on horizontal and vertical doors:
LUA:
local storage = 2000
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if getPlayerStorageValue(cid, storage) >= 1 then
		if ((getPosByLookDir(cid, 1, 1).x == getThingPos(item.uid).x) and (getPosByLookDir(cid, 1, 1).y == getThingPos(item.uid).y)) then
			doTeleportThing(cid, getPosByLookDir(cid, 2, 2))
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You need to look at the door")
		end
	else
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You shall not pass!!.")
	end
return TRUE
end

function getPosByLookDir(cid, t, r)
local a = t
local b = r
	if not isNumber(a) or not isNumber(b) then
		a = 0
		b = 0
	end
local i = {
	[3] = {x=getCreaturePosition(cid).x-a, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}, 
	[1] = {x=getCreaturePosition(cid).x+a, y=getCreaturePosition(cid).y, z=getCreaturePosition(cid).z}, 
	[0] = {x=getCreaturePosition(cid).x, y=getCreaturePosition(cid).y-b, z=getCreaturePosition(cid).z}, 
	[2] = {x=getCreaturePosition(cid).x, y=getCreaturePosition(cid).y+b, z=getCreaturePosition(cid).z}
	}
a = r
b = t
return i[getPlayerLookDirection(cid)]
end
I bet it could be way shorter, but whatever :p
 
Back
Top