Matti96
Abyss
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?
Thank you!
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local vocation = {}
function onCreatureAppear(cid) npcHandlernCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandlernCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandlernCreatureSay(cid, type, msg) end
function onThink() npcHandlernThink() 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!