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

[Help] Quest door

ond

Veteran OT User
Joined
Mar 24, 2008
Messages
2,782
Solutions
25
Reaction score
491
Location
Sweden
I need help with my quest door script! Is it possible to make it reversed
(getPlayerStorageValue(cid, item.actionid) == -1)
by using actionid 3001-3999? Here is my example:

LUA:
function onUse(cid, item, frompos, item2, topos)
	if(item.actionid == 0) then
		-- Make it a normal door
		doTransformItem(item.uid, item.itemid+1)
		return TRUE
	end

	local canEnter = (getPlayerStorageValue(cid, item.actionid) == 1)
	if not(canEnter) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door is sealed against unwanted intruders.")
		return TRUE
	end

	doTransformItem(item.uid, item.itemid+1)
	local canGo = (queryTileAddThing(cid, frompos, bit.bor(2, 4)) == RETURNVALUE_NOERROR) --Veryfies if the player can go, ignoring blocking things
	if not(canGo) then
		return FALSE
	end

	local dir = getDirectionTo(getPlayerPosition(cid), frompos)
	doMoveCreature(cid, dir)
	return TRUE
end

elseif(item.actionid >= 3001 and item.actionid <= 3999)then

	local canEnter = (getPlayerStorageValue(cid, item.actionid) == -1)
	if not(canEnter) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door is sealed against unwanted intruders.")
		return TRUE
	end

	doTransformItem(item.uid, item.itemid+1)
	local canGo = (queryTileAddThing(cid, frompos, bit.bor(2, 4)) == RETURNVALUE_NOERROR) --Veryfies if the player can go, ignoring blocking things
	if not(canGo) then
		return FALSE
	end

	local dir = getDirectionTo(getPlayerPosition(cid), frompos)
	doMoveCreature(cid, dir)
	return TRUE
end

Something like that! Post if you didn't understand my thinking.
 
Code:
function onUse(cid, item, frompos, item2, topos)
	if(item.actionid == 0) then
		-- Make it a normal door
		doTransformItem(item.uid, item.itemid+1)
		return TRUE
	end

	if getPlayerStorageValue(cid, item.actionid) ~= ((item.actionid >= 3001 and item.actionid <= 3999) and -1 or 1) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The door is sealed against unwanted intruders.")
		return TRUE
	end

	doTransformItem(item.uid, item.itemid+1)
	if queryTileAddThing(cid, frompos, bit.bor(2, 4)) ~= RETURNVALUE_NOERROR then
		return FALSE
	end

	local dir = getDirectionTo(getPlayerPosition(cid), frompos)
	doMoveCreature(cid, dir)
	return TRUE
end
 
Back
Top