I have a problem with my npc.
I can become the item unlimited..
What i must to change when i would like become it only ones?
I can become the item unlimited..
What i must to change when i would like become it only ones?
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)
if(not npcHandler:isFocused(cid)) then
return false
end
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if msgcontains(msg,'out') then
selfSay('Of course, the world is dangerous. I have a gift for you.', cid)
doPlayerAddItem(cid,8704)
getPlayerStorageValue(cid,48990,1)
doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have become a small potion!")
elseif getPlayerStorageValue(cid,48990) == 1 then
selfSay("You already have become the gift")
end
end
npcHandler:setCallback(CALLBACK_ONTHINK, thinkCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())