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
local citys = {
['thais'] = {money = 100, pos={x=32311, y=32210, z=6}},
['carlin'] ={money = 100, pos={x=32387, y=31821, z=6}}
}
function creatureSayCallback(cid, type, msg)
if (not npcHandler:isFocused(cid)) then
return false
end
if citys[msg] and not isPlayerPzLocked(cid) then
if doPlayerRemoveMoney(cid, citys[msg].money) == true then
doTeleportThing(cid,citys[msg].pos)
self:releaseFocus(cid)
else
npcHandler:say('You don\'t have enought money to travel!', cid)
self:releaseFocus(cid)
end
else
npcHandler:say('I cant travel there!', cid)
self:releaseFocus(cid)
end
if isPlayerPzLocked(cid) then
npcHandler:say('You can\'t travel, you have pz!', cid)
end
return true
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
keywordHandler:addKeyword({'travel'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can take you to all places: {thais}, {carlin}.'})
npcHandler:addModule(FocusModule:new())