Hmm whats the Problem, please help because i dont now it....
I think there is a problem with the talkState, but dont now how to fix...
I´m using Naxet ot 8.
I think there is a problem with the talkState, but dont now how to fix...
I´m using Naxet ot 8.
PHP:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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 storage = 14837
if msgcontains(msg,'help') then
if(getPlayerStorageValue(cid, storage) < 1) then
npcHandler:say("Bring me please for my new armor 3 wolf paw, 3 bear paw and 3 honeycomb.", cid)
setPlayerStorageValue(cid, storage, 1)
elseif (getPlayerStorageValue(cid, storage) == 1) then
npcHandler:say("Do you have the items for me?", cid)
talkState[talkUser] = 1
elseif(getPlayerStorageValue(cid, storage) == 2) then
npcHandler:say("Sorry, but i have right now nothing for you.", cid)
end
elseif (msgcontains(msg,'yes') and talkState[talkUser] == 1) then
if (doPlayerRemoveItem(cid, 5902, 3) and doPlayerRemoveItem(cid, 5896, 3) and doPlayerRemoveItem(cid, 5897, 3) == TRUE) then
npcHandler:say("Thanks, |PLAYERNAME|. This is the key to my room with a Reward.", cid)
doPlayerAddExp(cid, 10000)
local key = doPlayerAddItem(cid, 2088, 1)
doItemSetAttribute(key, "aid", 6222)
setPlayerStorageValue(cid, storage, 2)
talkState[talkUser] = 0
else
npcHandler:say("I don\´t see the items in your backpack.", cid)
talkState[talkUser] = 0
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] > 0) then
npcHandler:say("Then not.", cid)
talkState[talkUser] = 0
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Code:
[14/03/2011 21:59:34] [Error - Npc interface]
[14/03/2011 21:59:34] data/npc/scripts/dallheim.lua:onCreatureSay
[14/03/2011 21:59:34] Description:
[14/03/2011 21:59:34] data/npc/scripts/dallheim.lua:24: attempt to index global 'talkState' (a nil value)
[14/03/2011 21:59:34] stack traceback:
[14/03/2011 21:59:34] data/npc/scripts/dallheim.lua:24: in function 'callback'
[14/03/2011 21:59:34] data/npc/lib/npcsystem/npchandler.lua:383: in function 'onCreatureSay'
[14/03/2011 21:59:34] data/npc/scripts/dallheim.lua:7: in function <data/npc/scripts/dallheim.lua:7>
[14/03/2011 21:59:36] [Error - Npc interface]
[14/03/2011 21:59:36] data/npc/scripts/dallheim.lua:onCreatureSay
[14/03/2011 21:59:36] Description:
[14/03/2011 21:59:36] data/npc/scripts/dallheim.lua:29: attempt to index global 'talkState' (a nil value)
[14/03/2011 21:59:36] stack traceback:
[14/03/2011 21:59:36] data/npc/scripts/dallheim.lua:29: in function 'callback'
[14/03/2011 21:59:36] data/npc/lib/npcsystem/npchandler.lua:383: in function 'onCreatureSay'
[14/03/2011 21:59:36] data/npc/scripts/dallheim.lua:7: in function <data/npc/scripts/dallheim.lua:7>