hello otlanders
this script gives me error
Edited..
this script gives me error
Code:
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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
--[[
REMEMBER TO SET YOUR STORAGE AS YOURSTORAGE!
]]--
local storage = YOURSTORAGE
if(msgcontains(msg, 'quest') or msgcontains(msg, 'crystal')) then
if(getPlayerStorageValue(cid, storage) < 1) then
npcHandler:say("Hey, I have super quest for you. Bring me please {10 crystal coins}.", cid)
setPlayerStorageValue(cid, storage, 1)
elseif(getPlayerStorageValue(cid, storage) == 1) then
npcHandler:say("Do you have 10 crystal coins for me?", cid)
talkState[talkUser] = 1
elseif(getPlayerStorageValue(cid, storage) == 2) then
npcHandler:say("Sorry, you have already done my super quest.", cid)
end
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveMoney(cid, 100000) == TRUE) then
npcHandler:say("Thanks! As I said, here\'s 20 crystal coins!", cid)
doPlayerAddItem(cid, 2160, 20)
setPlayerStorageValue(cid, storage, 2)
talkState[talkUser] = 0
else
npcHandler:say("Sorry, you don\'t have enough money.", 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())
[20:23:26.515] [Error - NpcScript Interface]
[20:23:26.515] data/npc/scripts/anni.luanCreatureSay
[20:23:26.515] Description:
[20:23:26.515] data/npc/scripts/anni.lua:21: attempt to call global 'etPlayerIte
mCount' (a nil value)
[20:23:26.515] stack traceback:
[20:23:26.515] data/npc/scripts/anni.lua:21: in function 'callback'
[20:23:26.515] data/npc/lib/npcsystem/npchandler.lua:423: in function 'onCreatu
reSay'
[20:23:26.515] data/npc/scripts/anni.lua:7: in function <data/npc/scripts/anni.
lua:7>
Edited..
Last edited: