o erro está claramente na estrutura de controle if
if (getPlayerStorageValue(cid,2121) > 0) then
selfSay('Parabens, voce completou a missao!', cid)
else
if(doPlayerRemoveItem(cid, 2466, 1) == TRUE) then
setPlayerStorageValue(cid,2121,1)
doPlayerAddExperience(cid,10000)
doPlayeraddItem(cid, 2470, 1)
else
selfSay('Voce precisa ter mais items.', cid)
end
end
if bloco then
-- código
end
--------------------------------
if bloco then
--codigo
else
--codigo
end
--------------------------------
if bloco then
--codigo
elseif bloco then
-- codigo
end
--------------------------------
Toda vez que abrir um "if" se deve usar o "end" para fecha-lo
if (getPlayerStorageValue(cid,2121) <= 0) then
if (doPlayerRemoveItem(cid, 2466, 1) == TRUE) then
setPlayerStorageValue(cid,2121,1)
doPlayerAddExperience(cid,10000)
doPlayeraddItem(cid, 2470, 1)
selfSay('Parabens, voce completou a missao!', cid)
else
selfSay('Voce precisa ter mais items.', cid)
end
else
selfSay('você já recebeu sua recompensa!', cid)
talkState[talkUser] = 0
end







info
Grupo: Artesão
Registrado: 03/08/07
Posts: 129
Reputação: +12
Gênero: Masculino
O Devido script ele até funciona, ele responde todas as perguntas normalmente só que ele tira o item do player só que não manda a menssagem se ele tem ou não o item! Ajudem porfavor..
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
if msgcontains(msg, 'orcs') then
selfSay('Ok, confio na lealdade deles. Você quer ver a {Luna} não é?', cid)
talkState[talkUser] = 2
elseif talkState[talkUser] == 2 then
if msgcontains(msg, 'luna') then
selfSay('Você só poderá encontra-la se provar a sua fidelidade com os Elfos! Você deseja {continuar}?', cid)
talkState[talkUser] = 3
end
elseif talkState[talkUser] == 3 then
if msgcontains(msg, 'continuar') then
selfSay('Ok, prove sua bravura matando alguns Krakens e traga-me uma {Golden Armor}.', cid)
talkState[talkUser] = 3
elseif(msgcontains(msg, 'golden armor') and talkState[talkUser] == 3) then
if (getPlayerStorageValue(cid,2121) > 0) then
selfSay('Parabens, voce completou a missao!', cid)
else
if(doPlayerRemoveItem(cid, 2466, 1) == TRUE) then
setPlayerStorageValue(cid,2121,1)
doPlayerAddExperience(cid,10000)
doPlayeraddItem(cid, 2470, 1)
else
selfSay('Voce precisa ter mais items.', cid)
end
end
end
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())