Hiya there,
I use the following code in a NPC I made.
It asks for a single item, and if you say fix, yes, you trade the item for a other item. (2222). However, when I say yes, nothing happens.
Console error;
[23/02/2011 21:45:30] [Error - Npc interface]
[23/02/2011 21:45:30] data/npc/scripts/healer.luanCreatureSay
[23/02/2011 21:45:30] Description:
[23/02/2011 21:45:30] data/npc/scripts/healer.lua:27: table index is nil
[23/02/2011 21:45:30] stack traceback:
[23/02/2011 21:45:30] data/npc/scripts/healer.lua:27: in function 'callback'
[23/02/2011 21:45:30] data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[23/02/2011 21:45:30] data/npc/scripts/healer.lua:8: in function <data/npc/scripts/healer.lua:8>
Any idea?
Thanks in advance.
I use the following code in a NPC I made.
Lua:
if msgcontains(msg, 'fix') then
if(getPlayerItemCount(cid, 1111) >= 1) then
selfSay('Are you sure? I will give you 1 item in return.', cid)
talkState[talkUser] = 1
else
selfSay('You do not have any items.', cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(getPlayerItemCount(cid, 1111) >= 1) then
if(doPlayerTakeItem(cid, 1111, 1) == TRUE) then
doPlayerGiveItem(cid, 2222, 1)
selfSay('Here you are.', cid)
end
else
selfSay('Sorry, you don\'t have the requested item.', cid)
end
talkState[talkUser] = 0
elseif(msgcontains(msg, 'no') and isInArray({1}, talkState[talkUser]) == TRUE) then
talkState[talkUser] = 0
selfSay('Ok then.', cid)
end
It asks for a single item, and if you say fix, yes, you trade the item for a other item. (2222). However, when I say yes, nothing happens.
Console error;
[23/02/2011 21:45:30] [Error - Npc interface]
[23/02/2011 21:45:30] data/npc/scripts/healer.luanCreatureSay
[23/02/2011 21:45:30] Description:
[23/02/2011 21:45:30] data/npc/scripts/healer.lua:27: table index is nil
[23/02/2011 21:45:30] stack traceback:
[23/02/2011 21:45:30] data/npc/scripts/healer.lua:27: in function 'callback'
[23/02/2011 21:45:30] data/npc/lib/npcsystem/npchandler.lua:390: in function 'onCreatureSay'
[23/02/2011 21:45:30] data/npc/scripts/healer.lua:8: in function <data/npc/scripts/healer.lua:8>
Any idea?
Thanks in advance.