local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local voc = {}
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_PRIVATE and 0 or cid
if msgcontains(msg, 'teleport') or msgcontains(msg, 'tp') then
selfSay('Are you sure do you want be teleported?', cid)
talkState[talkUser] = 1
end
elseif talkState[talkUser] == 1 then
if msgcontains(msg, 'yes') then
local level = getPlayerLevel(cid)
local position = {x=453, y=480, z=6, stackpos=1}
if level >= 1 and level <= 20 then
selfSay('There you go!.', cid)
doTeleportThing(cid, position)
elseif level >= 21 and level <= 50 and doPlayerRemoveMoney(cid,1000) == TRUE then
selfSay('There you go!.', cid)
doTeleportThing(cid, position)
elseif level >= 51 and doPlayerRemoveMoney(cid,5000) == TRUE then
selfSay('Good luck!.', cid)
doTeleportThing(cid, Castle3)
else
selfSay('You do not have enought money.', cid)
talkState[talkUser] = 0
end
end
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())