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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local p = getPlayerPosition(cid)
local monster = "Trainer"
if(msgcontains(msg, 'hi') or msgcontains(msg, 'hello')) then
npcHandler:say("Hello |PLAYERNAME| I can obtain you a trainer for 300 gold pieces.", cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then
if(doPlayerRemoveMoney(cid, 300)) == true then
doSummonMonster(cid, monster, p)
else
npcHandler:say("Sorry, You dont have 300 gold pieces dont try to steal from me.", cid)
talkState[talkUser] = 0
end
return true
end