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

The Oracle - edited - NEED HELP!

Matti96

Abyss
Joined
Apr 17, 2009
Messages
254
Reaction score
46
Location
Poland/Germany
I was working on this oracle script. When I'm trying to run my server it says that there is some "end" expected. But I dont know where an "end" is missing. There is probably more then just one end missing. Could you fix it please? :D

local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local vocation = {}

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

local storage = 5003

function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if msgcontains(msg, "sorcerer") and talkState[talkUser] == 1 then
selfSay("A SORCERER? THIS DECISION IS IRREVERSIBLE!", cid)
talkState[talkUser] = 2
vocation[talkUser] = 1
else if msgcontains(msg, "druid") and talkState[talkUser] == 1 then
selfSay("A DRUID? THIS DECISION IS IRREVERSIBLE!", cid)
talkState[talkUser] = 2
vocation[talkUser] = 2
else if msgcontains(msg, "paladin") and talkState[talkUser] == 1 then
selfSay("A PALADIN? THIS DECISION IS IRREVERSIBLE!", cid)
talkState[talkUser] = 2
vocation[talkUser] = 3
else if msgcontains(msg, "knight") and talkState[talkUser] == 1 then
selfSay("A KNIGHT? THIS DECISION IS IRREVERSIBLE!", cid)
talkState[talkUser] = 2
vocation[talkUser] = 4
else if msgcontains(msg, "no") and talkState[talkUser] == 1 then
selfSay("COME BACK WHEN YOU ARE SURE ABOUT YOUR DECISION!", cid)
talkState[talkUser] = 0
return false
end
else if msgcontains(msg, "yes") then
if talkState[talkUser] == 2 then
selfSay("SO IT BE! NOW GO DOWNSTAIRS AND TALK TO VASCALIR! GOOD LUCK!", cid)
talkState[talkUser] = 0
doPlayerSetVocation(cid, vocation[talkUser])
else if getPlayerStorageValue(cid, storage) == 1 and talkState[talkUser] == 0 then
selfSay("DO YOU WANT TO BECOME A {SORCERER}, A {DRUID}, A {PALADIN} OR A {KNIGHT}?", cid)
talkState[talkUser] = 1
else if(getPlayerVocation(cid) > 0) then
selfSay("YOU ALREADY HAVE A VOCATION!", cid)
talkState[talkUser] = 0
return false
else if getPlayerStorageValue(cid, storage) == -1 and talkState[talkUser] == 0 then
selfSay("YOU SHOULD HELP {CIPFRIED} FIRST! YOU CAN FIND HIM IN THE TEMPLE!", cid)
talkState[talkUser] = 0
return false
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

Thank you!
 
Try this.
Regard Alw.

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local vocation = {}

function onCreatureAppear(cid) npcHandler:eek:nCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:eek:nCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:eek:nCreatureSay(cid, type, msg) end
function onThink() npcHandler:eek:nThink() end

local storage = 5003

function creatureSayCallback(cid, type, msg)
if not npcHandler:isFocused(cid) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid

if msgcontains(msg, "sorcerer") and talkState[talkUser] == 1 then
    selfSay("A SORCERER? THIS DECISION IS IRREVERSIBLE!", cid)
    talkState[talkUser] = 2
    vocation[talkUser] = 1
else if msgcontains(msg, "druid") and talkState[talkUser] == 1 then
    selfSay("A DRUID? THIS DECISION IS IRREVERSIBLE!", cid)
    talkState[talkUser] = 2
    vocation[talkUser] = 2
else if msgcontains(msg, "paladin") and talkState[talkUser] == 1 then
    selfSay("A PALADIN? THIS DECISION IS IRREVERSIBLE!", cid)
    talkState[talkUser] = 2
    vocation[talkUser] = 3
else if msgcontains(msg, "knight") and talkState[talkUser] == 1 then
    selfSay("A KNIGHT? THIS DECISION IS IRREVERSIBLE!", cid)
    talkState[talkUser] = 2
    vocation[talkUser] = 4
else if msgcontains(msg, "no") and talkState[talkUser] == 1 then
    selfSay("COME BACK WHEN YOU ARE SURE ABOUT YOUR DECISION!", cid)
    talkState[talkUser] = 0
    npcHandler:releaseFocus(cid)
else if msgcontains(msg, "yes") then
    if talkState[talkUser] == 2 then
        selfSay("SO IT BE! NOW GO DOWNSTAIRS AND TALK TO VASCALIR! GOOD LUCK!", cid)
        talkState[talkUser] = 0
        doPlayerSetVocation(cid, vocation[talkUser])
    else if (getPlayerStorageValue(cid, storage) == 1 and talkState[talkUser] == 0 then
        selfSay("DO YOU WANT TO BECOME A {SORCERER}, A {DRUID}, A {PALADIN} OR A {KNIGHT}?", cid)
        talkState[talkUser] = 1   
    else if(getPlayerVocation(cid) > 0) then
        selfSay("YOU ALREADY HAVE A VOCATION!", cid)
        talkState[talkUser] = 0
        npcHandler:releaseFocus(cid)
    else if (getPlayerStorageValue(cid, storage) == -1 and talkState[talkUser] == 0) then
        selfSay("YOU SHOULD HELP {CIPFRIED} FIRST! YOU CAN FIND HIM IN THE TEMPLE!", cid)
        talkState[talkUser] = 0
        npcHandler:releaseFocus(cid)
    end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top