o script e o seguinte...
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 crystalid = 9971
local storage = 9971
local getstorage = getPlayerStorageValue(cid, storage)
local sorrymessage = "Desculpe, voce nao tem todos os gold ingot para completar as missoes..."
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg, 'gold ingot') then
if getstorage == 6 then
npcHandler:say("Voce ja completou a quest", cid)
elseif getstorage < 6 then
npcHandler:say("Voce tem todos os gold ingot necessarios?", cid)
talkState[talkUser] = 1
end
elseif msgcontains(msg, 'quest') then
if getstorage < 1 then
npcHandler:say("Voce precisa de 25 {gold ingot} para comecar. encontre-os em {infernalist}.", cid)
elseif getstorage == 1 then
npcHandler:say("Voce esta na segunda parte e precisa de mais 25 gold ingot para continuar.", cid)
elseif getstorage == 2 then
npcHandler:say("Voce esta na terceira parte e precisa de mais 25 gold ingot para continuar.", cid)
elseif getstorage == 3 then
npcHandler:say("Voce esta na quarta parte e precisa de mais 25 gold ingot para continuar.", cid)
elseif getstorage == 4 then
npcHandler:say("Voce esta na quinta parte e precisa de mais 25 gold ingot para continuar.", cid)
elseif getstorage == 5 then
npcHandler:say("Voce esta na sexta e ultima parte missao e precisa de mais 25 gold ingot para acabar.", cid)
elseif getstorage == 6 then
npcHandler:say("Voce completou todas as missoes.", cid)
end
elseif msgcontains(msg, 'yes') then
if talkState[talkUser] == 1 then
if getstorage < 0 then
if doPlayerRemoveItem(cid, crystalid, 25) == TRUE then
npcHandler:say("Voce ja me deu 25 gold ingot . Agora irei precisar de mais {25}.", cid)
setPlayerStorageValue(cid, storage, 1)
doPlayerAddExp(cid, 1000)
talkState[talkUser] = 0
elseif doPlayerRemoveItem(cid, crystalid, 1) == FALSE then
npcHandler:say(sorrymessage, cid)
talkState[talkUser] = 0
end
elseif getstorage == 1 then
if doPlayerRemoveItem(cid, crystalid, 25) == TRUE then
npcHandler:say("Voce ja me deu 25 gold ingot . Agora irei precisar de mais {25}.", cid)
setPlayerStorageValue(cid, storage, 2)
doPlayerAddExp(cid, 2000)
talkState[talkUser] = 0
elseif doPlayerRemoveItem(cid, crystalid, 5) == FALSE then
npcHandler:say(sorrymessage, cid)
talkState[talkUser] = 0
end
elseif getstorage == 2 then
if doPlayerRemoveItem(cid, crystalid, 25) == TRUE then
npcHandler:say("Voce ja me deu 25 gold ingot. Agora irei precisar de mais {25}.", cid)
setPlayerStorageValue(cid, storage, 3)
doPlayerAddExp(cid, 3000)
talkState[talkUser] = 0
elseif doPlayerRemoveItem(cid, crystalid, 7) == FALSE then
npcHandler:say(sorrymessage, cid)
talkState[talkUser] = 0
end
elseif getstorage == 3 then
if doPlayerRemoveItem(cid, crystalid, 25) == TRUE then
npcHandler:say("Voce ja me deu 25 gold ingot. Agora irei precisar de mais {25}.", cid)
setPlayerStorageValue(cid, storage, 4)
doPlayerAddExp(cid, 4000)
talkState[talkUser] = 0
elseif doPlayerRemoveItem(cid, crystalid, 10) == FALSE then
npcHandler:say(sorrymessage, cid)
talkState[talkUser] = 0
end
elseif getstorage == 4 then
if doPlayerRemoveItem(cid, crystalid, 25) == TRUE then
npcHandler:say("Voce ja me deu 25 gold ingot. E por ultimo, irei precisar de mais {25}.", cid)
setPlayerStorageValue(cid, storage, 5)
doPlayerAddExp(cid, 5000)
talkState[talkUser] = 0
elseif doPlayerRemoveItem(cid, crystalid, 15) == FALSE then
npcHandler:say(sorrymessage, cid)
talkState[talkUser] = 0
end
elseif getstorage == 5 then
if doPlayerRemoveItem(cid, crystalid, 25) == TRUE then
npcHandler:say("Parabens ,para quer receber seus premios agora? Diga {yes}.", cid)
setPlayerStorageValue(cid, storage, 6)
doPlayerAddItem(cid, 12279, 1)
doPlayerAddItem(cid, 2160, 50)
doPlayerAddExp(cid, 15000)
doPlayerAddItem(cid, 9933, 1)
talkState[talkUser] = 0
elseif doPlayerRemoveItem(cid, crystalid, 25) == FALSE then
npcHandler:say(sorrymessage, cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
esta dando o erro:
[13/10/2014 21:12:31] [Error - LuaScriptInterface::loadFile] data/npc/scripts/missings/gold ingot.lua:109: 'end' expected (to close 'if' at line 42) near '<eof>'
[13/10/2014 21:12:31] [Warning - NpcScript::NpcScript] Cannot load script: data/npc/scripts/missings/gold ingot.lua
[13/10/2014 21:12:31] data/npc/scripts/missings/gold ingot.lua:109: 'end' expected (to close 'if' at line 42) near '<eof>'