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

Can someone help me redo this for 8.54 please

chubby711

New Member
Joined
Jan 11, 2009
Messages
32
Reaction score
0
I found this script and i've been trying to work on it to make it for 8.54 but I ran into some trouble.. please help!

Lua:
local standPos = {x=100, y=100, z=7} -- Player Stands Here
local bookCasePos = {x=100, y=100, z=7} -- Bookcase Spot
local passageKey = "Open Sesame" -- Message player has to say
local openTime = 10 -- Seconds the passage will remain open
local passageID = XXXX -- Passage Door/Blocking Item ID

local function countDown(n)
    if(n > 0) then
        doSendAnimatedText(bookCasePos, n, TEXTCOLOR_RED)
        addEvent(countDown, 1000, n - 1)
    else
        local bookCase = getTileItemById(bookCasePos, passageID)
        if(bookCase.uid == 0) then
            doCreateItem(bookCasePos, passageID)
        end
    end
end

function onSay(cid, words, param)
    if(#param == 0) then
        doPlayerSendCancel(cid, "Command requires param.")
        return true
    end
    
    if(param:lower() == passageKey:lower()) then
        if(comparePos(getCreaturePosition(cid), standPos)) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Passage has been revealed!")
            local passageWay = getTileItemById(bookCasePos, passageID)
            if(passageWay.uid ~= 0) then
                doRemoveItem(passageWay.uid)
            end
            countDown(openTime)
        else
            doPlayerSendCancel(cid, "You must stand on the correct spot.")
        end
    else
        doPlayerSendCancel(cid, "You must say the correct password to open the passage.")
    end
    return true
end
 
only one line when the stone is supposed to be replaced.. it says error cannot find global comparePos line 26 or whatever line that is ;o
 
well, i can config this for your'luck :)

First, you need add this in your Data/Lib/functions.lua
Code:
function comparePos(pos1, pos2)
    return (pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z)
end

Second, you replace your script for this.
Code:
local standPos = {x=?, y=?, z=?} -- Player Stands Here
local bookCasePos = {x=?, y=?, z=?} -- Bookcase Spot
local passageKey = "sesame" -- Message player has to say
local openTime = 10 -- Seconds the passage will remain open
local passageID = 1718 -- Passage Door/Blocking Item ID

local function countDown(n)
    if(n > 0) then
        doSendAnimatedText(bookCasePos, n, TEXTCOLOR_RED)
        addEvent(countDown, 1000, n - 1)
    else
        local bookCase = getTileItemById(bookCasePos, passageID)
        if(bookCase.uid == 0) then
            doCreateItem(passageID, bookCasePos)
        end
    end
end

function onSay(cid, words, param, channel)
    if(#param == 0) then
        doPlayerSendCancel(cid, "Command requires param.")
end
   
    if(param:lower() == passageKey:lower()) then
        if(comparePos(getCreaturePosition(cid), standPos)) then
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Passage has been revealed!")
            local passageWay = getTileItemById(bookCasePos, passageID)
            if(passageWay.uid ~= 0) then
                doRemoveItem(passageWay.uid)
            end
            countDown(openTime)
        else
            doPlayerSendCancel(cid, "You must stand on the correct spot.")
        end
    else
        doPlayerSendCancel(cid, "You must say the correct password to open the passage.")
    end
    return true
end

Now you need say !open sesame in StandPos 'local standPos = {x=?, y=?, z=?} -- Player Stands Here' to open the passage.
If you want to change the bookcase for wall or another item, edit this, local passageID = 1718 -- Passage Door/Blocking Item ID

Thanks for all and give-me Rep++ PLEASE! :thumbup::wub:​
 
Back
Top