azzkaban
Monster Maker
Hi, can you help me?
Error:
Script:
Error:
Code:
[14/12/2013 19:9:49] [Error - LuaInterface::loadFile] data/npc/scripts/Travel NPC/Ledtheron.lua:21: 'end' expected (to close 'function' at line 11) near 'elseif'
[14/12/2013 19:9:49] [Warning - NpcEvents::NpcEvents] Cannot load script: data/npc/scripts/Travel NPC/Ledtheron.lua
[14/12/2013 19:9:49] data/npc/scripts/Travel NPC/Ledtheron.lua:21: 'end' expected (to close 'function' at line 11) near 'elseif'
Script:
Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end
function creatureSayCallback(cid, type, msg)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local city = {{x=100,y=100,z=7},"Thais",50}
if(msgcontains(msg, city[2])) then
selfSay('Do you want to travel to '..k..' for '..v.cost..' gold coins?', cid)
talkState[talkUser] = v.talk
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == v.talk) then
if hasCondition(cid, CONDITION_INFIGHT) then
if getPlayerPremiumDays(cid) > 0 then
if(doPlayerRemoveMoney(cid, city[3]) == TRUE) then
doTeleportThing(cid, city[1], FALSE)
selfSay('Traveled to '..city[2] ..'.', cid)
else
selfSay('Sorry, you don\'t have enough gold coins.', cid)
end
else
selfSay("Sorry, you need premium.",cid)
talkState[talkUser] = 0
end
else
selfSay("Sorry, you have pz!",cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and isInArray({v.talk}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())