Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local shortsword = 2406 -- TUTAJ WPISZ ID SHORT SWORDA
local book1 = 1955 -- TUTAJ WPISZ ID KSIĄŻKI1
local book2 = 12497 -- TUTAJ WPISZ ID KSIĄŻKI2
local book3 = 12406 -- TUTAJ WPISZ ID KSIĄŻKI3
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
-- Storage IDs --
fdruid = 22043
sdruid = 22044
newaddon = 'Just in time! Your backpack is finished. Here you go, I hope you like it.'
noitems = 'Sorry, but that\'s not enough leather to make one of these backpacks.'
noitems2 = 'Sorry, but that\'s not enough leather to make one of these backpacks.'
already = 'It seems you already have this addon, don\'t you try to mock me son!'
function citizenfirst(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end
if isPremium(cid) then
addon = getPlayerStorageValue(cid,fdruid)
if addon == -1 then
if getPlayerItemCount(cid,5878)>= 100 then
if doPlayerRemoveItem(cid,5878,100) and getPlayerSex(cid) == 1 then
doCreatureSay('Just in time! Your backpack is finished. Here you go, I hope you like it.')
doSendMagicEffect(getCreaturePosition(cid), 13)
setPlayerStorageValue(cid,fdruid,1)
doPlayerAddOutfit(cid, 128, 1)
elseif doPlayerRemoveItem(cid,5878,100) and getPlayerSex(cid) == 0 then
doCreatureSay('Just in time! Your backpack is finished. Here you go, I hope you like it.')
doSendMagicEffect(getCreaturePosition(cid), 13)
setPlayerStorageValue(cid,fdruid,1)
doPlayerAddOutfit(cid, 136, 1)
end
else
selfSay(noitems)
end
else
selfSay(already)
end
end
end
node1 = keywordHandler:addKeyword({'minotaur leather'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?'})
node1:addChildKeyword({'yes'}, citizenfirst, {})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I know, it\'s quite some work... don\'t lose heart, just keep killing minotaurs and you\'ll eventually get lucky.', reset = true})
node2 = keywordHandler:addKeyword({'minotaur leathers'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Ah, right, almost forgot about the backpack! Have you brought me 100 pieces of minotaur leather as requested?'})
node2:addChildKeyword({'yes'}, citizenfirst, {})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I know, it\'s quite some work... don\'t lose heart, just keep killing minotaurs and you\'ll eventually get lucky.', reset = true})
if(msgcontains(msg, 'help')) then
npcHandler:say("I lost my book\'s somewhere, if you bring me one of them then i will reward you. Do you have my book?.", cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveItem(cid, book1, 1) or doPlayerRemoveItem(cid, book2, 1) or doPlayerRemoveItem(cid, book3, 1)) then
doPlayerAddItem(cid, shortsword, 1)
setPlayerStorageValue(cid, 10001, 1)
npcHandler:say("Thank you stranger! Please, this is your reward. Go back if you find another one.", cid)
else
npcHandler:say("You don\'t have a book! Bring it to me and then we will talk..", cid)
end
elseif(msgcontains(msg, 'no') and talkState[talkUser] == 1) then
npcHandler:say("Come back if you got that book.", cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Why it's not work? no any error :-/ He dont respond for addon :-/