highclick
New Member
- Joined
- Mar 21, 2011
- Messages
- 80
- Reaction score
- 4
This is what I've got so far.
TFS 0.3.6
Errors:
After i type hi then "help" the npc starts too respond in default chat.
When I've got the feather she wont take it
TFS 0.3.6
PHP:
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
local storage = 5001
function creatureSayCallback(cid, type, msg)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
if not npcHandler:isFocused(cid) then
if msg == "hi" or msg == "hello" then
if getPlayerStorageValue(cid, storage) == -1 then
selfSay("Silence! You are disturbing the ritual, either {help} me or be gone!", cid)
talkState[talkUser] = 1
elseif getPlayerStorageValue(cid, storage) == 1 then
selfSay("Well, did you get me the feather?", cid)
talkState[talkUser] = 1
else
selfSay("Thank you for helping me out!", cid)
end
npcHandler:addFocus(cid)
else
return false
end
end
if msg == "help" and talkState[talkUser] == 1 then
selfSay("I need a chicken feather, will you get it for me?")
talkState[talkUser] = 2
elseif msg == "Yes" and talkState[talkUser] == 1 then
if doPlayerRemoveItem(cid, 5890, 1) then
selfSay("Thank you!", cid)
doPlayerAddItem(cid, 2160, 3)
doPlayerAddExp(cid, 5000)
setPlayerStorageValue(cid, storage, 2)
else
selfSay("You don't have the feather")
end
end
if msg == "yes" and talkState[talkUser] == 2 then
selfSay("Thank you, I'll be waiting for you!")
setPlayerStorageValue(cid, storage, 1)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
Errors:
After i type hi then "help" the npc starts too respond in default chat.
When I've got the feather she wont take it