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

Lua Storagedoor Bug!

Majeski20

New Member
Joined
Apr 21, 2008
Messages
602
Reaction score
4
Location
Sweden
Hello, i got a problem with my storage door, when i use it im getting stuck in it, i do not get teleported 1 sqm ahead. Why is that?
Can somone get it right :)?

insidedoorb.jpg


Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if item.uid == 10281 then
		if(isInArray({getPlayerStorageValue(cid, 10274), getPlayerStorageValue(cid, 10275), getPlayerStorageValue(cid, 10276), getPlayerStorageValue(cid, 10277), getPlayerStorageValue(cid, 10278), getPlayerStorageValue(cid, 10279), getPlayerStorageValue(cid, 10280)}, -1) == TRUE) then
  			doCreatureSay(cid, "You have not enought energy to pass.", TALKTYPE_ORANGE_1)
		else
			doCreatureSay(cid, "You have completed the quest.", TALKTYPE_ORANGE_1)
			doTeleportThing(cid, toPosition, TRUE)
		end
		return TRUE
	end
	return FALSE
end
 
@up
-1* + you forgot the close the {
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(isInArray({getPlayerStorageValue(cid, 10274), getPlayerStorageValue(cid, 10275), getPlayerStorageValue(cid, 10276), getPlayerStorageValue(cid, 10277), getPlayerStorageValue(cid, 10278), getPlayerStorageValue(cid, 10279), getPlayerStorageValue(cid, 10280)}, 1) == TRUE) 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
It's kinda long cuz you can use it for more doors, but whatever.
 
@up
-1* + you forgot the close the {
Lua:
function onUse(cid, item, fromPosition, itemEx, toPosition)
	if(isInArray({getPlayerStorageValue(cid, 10274), getPlayerStorageValue(cid, 10275), getPlayerStorageValue(cid, 10276), getPlayerStorageValue(cid, 10277), getPlayerStorageValue(cid, 10278), getPlayerStorageValue(cid, 10279), getPlayerStorageValue(cid, 10280)}, 1) == TRUE) 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
It's kinda long cuz you can use it for more doors, but whatever.

Thank you it works great, can you add green magic when using door :)?
 
Back
Top Bottom