Script Primeiro:
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)
if(not npcHandler:isFocused(cid)) then
return FALSE
end
if msgcontains(msg, "offer") or msgcontains(msg, "trade") or msgcontains(msg, "buy") then
selfSay("I can sell for you a "..getItemNameById(2345).." for 300000 gold coins you buy?", cid)
talkState[cid] = 1
elseif msgcontains(msg, "yes") and talkState[cid] == 1 then
if doPlayerRemoveMoney(cid, 300000) then
selfSay("Here your item.", cid)
doPlayerAddItem(cid, 2345, 1)
talkState[cid] = 0
else
selfSay("You dont have 300000 gold coins.", cid)
end
elseif msgcontains(msg, "no") and talkState[cid] == 1 then
selfSay("What you want?", cid)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Script Segundo:
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)
if(not npcHandler:isFocused(cid)) then
return FALSE
end
if msgcontains(msg, "help") or msgcontains(msg, "offer") then
selfSay("I can {travel} you for the party if you have a spy report.", cid)
talkState[cid] = 0
elseif msgcontains(msg, "travel") then
selfSay("Are you sure you want to pay a spy report to travel?", cid)
talkState[cid] = 1
elseif msgcontains(msg, "yes") and talkState[cid] == 1 then
if not isPlayerPzLocked(cid) then
if doPlayerRemoveItem(cid, 2345, 1) then
selfSay("Here we go.", cid)
doTeleportThing(cid, {x=1231,y=978,z=6})
talkState[cid] = 0
else
selfSay("You dont have a spy report.", cid)
end
else
selfSay("You can't travel with battle.", cid)
end
elseif msgcontains(msg, "no") and talkState[cid] == 1 then
selfSay("So what you want?.", cid)
end
end
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
Malz mais to sem tempo pra explicar se quiser seguir as explicaçoes do topico que eu te respondi hoje eh so mudar o nome e o caminho do script flw..




info
Grupo: Campones
Registrado: 19/12/08
Posts: 22
Reputação: +2
Tipo do script: --
Protocolo (versão do Tibia): 8.54
Servidor utilizado:TFS
Nível de experiência:--
Adicionais/Informações:
olá pessoal do Xtibia, queria fazer um pedido de 4 NPCS
#Primeiro NPC#
Um NPC que venda tal item por tal preço.
ID do item a ser vendido:2345
Preço do item a ser vendido: 300k
Nome do NPC: Indispensaveis
#Segundo NPC#
Um NPC que te leva para tal lugar se você tiver tal item.
Nome do lugar onde o NPC vai te levar: Party
Qual item precisa pro NPC te levar: 2345
Posição X, Y e Z, que o NPC vai te levar: x: 1231 y:978 z:6
Nome do NPC: Segurança
#Terceiro NPC#
Um NPC que vende mais de 1 item por tal preço:
IDs dos itens a serem vendidos: 6570, 6571, 6572, 6578, 6576
Preço dos itens a serem vendidos: todos por 500gps (gold coins)
Nome do NPC: Festeiro
#Quarto NPC#
Um NPC que vende mais de 1 item por tal preço:
IDs dos itens a serem vendidos: 2670, 6280, 6569, 2688
Preço dos itens a serem vendidos: todos por 500gps (gold coins)
Nome do NPC: Petiscos
bom é isso, se alguém puder me ajudar fico grato.
Editado Junho 26 por tricolorgaucho