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

Special doors

pioncz

New Member
Joined
Dec 3, 2008
Messages
149
Reaction score
1
Hi,
How to make doors that teleports depend on id?
When doors are horizontal so it teleport doorpos.y-1 or doorpos.y+1
but when they are vertical so they teleports x+1 or x-1 (depends on player position).
I've made this but its just a seed of script:
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local newPosition = toPosition
	newPosition.y = newPosition.y + 1
	local doorPosition = fromPosition
	local newPos = {x=1000, y=1000, z=7}
        doTeleportThing(cid, newPos)
        doSendMagicEffect(getCreaturePosition(cid), CONST_ME_HEARTS)
return true
end
It runs on actionid 1001 (so i can make this action on each one door).
 
hmm u must make 2 script and give action id vertikal and other for horizontal :) u must take pos of item (door) and and y or add x ;)
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local pos, door = getThingPos(cid), toPosition
	if isInArray({door.x-1, door.x+1}, pos.x) and pos.y == door.y then
		door.x = door.x + (pos.x < door.x and 1 or -1)
	elseif isInArray({door.y-1, door.y+1}, pos.y) and pos.x == door.x then
		door.y = door.y + (pos.y < door.y and 1 or -1)
	else
		return doPlayerSendCancel(cid, 'You must stand in front of the door!')
	end
	doTeleportThing(cid, door)
	doSendMagicEffect(door, CONST_ME_HEARTS)
	return true
end
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local cidPosition = getCreaturePosition(cid)
		if (item.uniqueid == 1001) then
			if cidPosition.x < toPosition.x then
				doTeleportThing(cid, {x=toPosition.x+1,y=toPosition.y,z=toPosition.z}, TRUE)
			else
				doTeleportThing(cid, {x=toPosition.x-1,y=toPosition.y,z=toPosition.z}, TRUE)
			end
			return TRUE
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Can't happen!")
			return TRUE
	end
	return FALSE
end
If i helped add rep++ for me please and i give it back :D
 
Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local cidPosition = getCreaturePosition(cid)
		if (item.uniqueid == 1001) then
			if cidPosition.x < toPosition.x then
				doTeleportThing(cid, {x=toPosition.x+1,y=toPosition.y,z=toPosition.z}, TRUE)
			else
				doTeleportThing(cid, {x=toPosition.x-1,y=toPosition.y,z=toPosition.z}, TRUE)
			end
			return TRUE
		else
			doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Can't happen!")
			return TRUE
	end
	return FALSE
end
If i helped add rep++ for me please and i give it back :D
why do you keep posting shit if it's already solved?
 
Back
Top