local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
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
if(msgcontains(msg, 'premium'))then
npcHandler:say('Premium kosztuje 10cc i jest na 7 dni. Chcesz kupic premium?', cid)
talkState = 1
elseif(talkState == 1 and msgcontains(msg, 'yes'))then
if(doPlayerRemoveMoney(cid, 100000) == TRUE)then
npcHandler:say('Gratuluje masz premium.', cid)
doPlayerAddPremiumDays(cid, 7)
else
npcHandler:say('Nie masz tyle pieniedzy!', cid)
end
talkState = 0
end
return TRUE
end
local node1 = keywordHandler:addKeyword({'promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Promocja kosztuje 15cc. Chcesz kupic promocje?'})
node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 150000, level = 5, promotion = 1, text = 'Gratuluje masz promocje.'})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Wroc kiedy bedziesz gotowy!', reset = true})
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())