Tó:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
storage1 = 19231 -- Storage
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
if msgcontains(msg, "quest") or msgcontains(msg, "mission") then
selfSay("Para você sair eu preciso de 1 "..getItemNameById(itemid)..". Will you bring me a draconian steel and an obsidian lance to exchange for an obsidian knife?", cid)
talkState[talkUser] = 0
elseif msgcontains(msg, 'yes') then
if getPlayerStorageValue(cid,storage1) < 1 then
doPlayerAddItem(cid,5908,1)
setPlayerStorageValue(cid,storage1,1)
selfSay("Adeus.", cid)
doTeleportThing(cid, pos)
else
selfSay("Você não possui o item que eu preciso.", cid)
end
end
return TRUE
end
O erro é que tava assim:
talkState[talkUser] == 0
Mas o certo é assim:
talkState[talkUser] = 0


info
Grupo: Artesão
Registrado: 08/10/12
Posts: 114
Reputação: 0
O que há de errado nesse script? Ta dando um erro: Attempt to call a nill value Stack traceback.
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
storage1 = 19231 -------------- Storagevalue
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
if msgcontains(msg, "quest") or msgcontains(msg, "mission") then
selfSay("Para voce sair eu preciso de 1 "..getItemNameById(itemid)..", You bringing me draconian steel and obsidian lance in exchange for obsidian knife?", cid)
talkState[talkUser] == 0
elseif msgcontains(msg, 'yes') then
if getPlayerStorageValue(cid,storage1) < 1 then
doPlayerAddItem(cid,5908,1)
setPlayerStorageValue(cid,storage1,1)
selfSay("Adeus.", cid)
doTeleportThing(cid, pos)
else
selfSay("Voce nao possui o item que eu preciso.", cid)
end
end
return TRUE
end