local t = {
stand = {x = 100, y = 100, z = 7}, -- Where you must stand
bookCase = {1719, 10, -- The BOOKCASE ID // [10 = how long it will be open]
{x = 100, y = 100, z = 7} -- The position of the bookcase.
},
words = "open" -- The passphrase
}
local function countDown(i)
if(i > 0) then
addEvent(countDown, 1000, i - 1)
else
local bookCase = getTileItemById(t.bookCase[3], t.bookCase[1]).uid
if(bookCase == 0) then
doCreateItem(t.bookCase[1], 1, t.bookCase[3])
end
end
end
function onSay(cid, words, param, channel)
if(words == t.words) then
if(#param == 0) then
if(doComparePositions(getThingPosition(cid), t.stand)) then
doCreatureSay(cid, "The passage has been revealed!", TALKTYPE_MONSTER)
local passageWay = getTileItemById(t.bookCase[3], t.bookCase[1])
if(passageWay.uid ~= 0) then
doRemoveItem(passageWay.uid)
doSendMagicEffect(t.bookCase[3], CONST_ME_POFF)
end
countDown(t.bookCase[2])
else
doPlayerSendCancel(cid, "You must stand on the correct spot.")
end
end
end
return true
end