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 addPremium(cid, message, keywords, parameters, node)
if(cid ~= npcHandler.focus) then
return false
end
local cost = parameters.cost
id = parameters.id
if doPlayerRemoveMoney(cid, cost) == TRUE then
doPlayerAddPremiumDays(cid, days)
npcHandler:say('Great!')
else
end
keywordHandler:moveUp(1)
return true
end
local node = keywordHandler:addKeyword({'premium'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Are you sure?'})
node:addChildKeyword({'yes'}, addPremium, {cost = 7000, days = 7})
node:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Maybe next time.'})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can add you premmy days for money. I can add you 7 days premium for 7 k.'})
npcHandler:addModule(FocusModule:new())