npctp.lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local talkState = {}
local pos = {x=152,y=58,z=7} -------------- Pos para onde o player sera levado
local itemid = 2160 ----------------- Id do item que vai ser removido do player
local quantia = 10 -------------Quantidade do tal item
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, "offer") or msgcontains(msg, "help") then
selfSay("Eu posso te levar a TAL lugar por um "..getItemNameById(itemid).." item, fale {travel} se quizer viajar.", cid)
talkState[cid] = 0
elseif msgcontains(msg, 'travel') then
if doPlayerRemoveItem(cid, itemid, quantia, 1) then
selfSay("Boa viagem.", cid)
doTeleportThing(cid, pos)
else
selfSay("Voce não tem grana suficiente.", cid)
end
end
return TRUE
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Crystal Coin: 2160
Platinum Coin: 2152
Gold Coin: 2148
Npctp.xml:
<npc name="NOMEDONPC" script="data/npc/scripts/npctp.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="134" head="78" body="88" legs="0" feet="88" addons="3"/>
<parameters>
<parameter key="message_greet" value="Ola. Para mais informacoes de meus servicos diga {offer}." />
<parameter key="message_farewell" value="Tchau." />
<parameter key="message_walkaway" value="Tchau." />
</parameters>
</npc>





info
Grupo: Campones
Registrado: 29/05/13
Posts: 51
Reputação: +4
Char no Tibia: Nunca Joguei
Bom gente Axei Varios ncp de teleport Mais não igual oque eo kero .
Quero um Simples que só ira cobrar um XXX de dinheiro e teleporte a pessoa pra XXX lugar .
Eo axei Script parecido só que tinha tempo pra voltar . Como Eo não sei Editar Não mexi pra n dar Erro .
Ajudo ? Ganho Rep +