Esse npc eu já havia feito para outro player.
Em data/npc/scripts crie um arquivo.lua nomeie para npcvip e adicione:
local focus = 0
local talk_start = 0
local target = 0
local days = 0
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Ola ' .. creatureGetName(cid) .. '! Eu vendo VIP e itens VIP.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Desculpe, ' .. creatureGetName(cid) .. '! Falarei com voce em alguns instantes.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'promoted') or msgcontains(msg, 'promotion') then
if getPlayerVocation(cid) > 4 then
selfSay('Desculpe, voce ja esta promovido.')
talk_state = 0
elseif getPlayerLevel(cid) < 20 then
selfSay('Voce precisa ter no minimo level 20...')
talk_state = 0
elseif not getPlayerPremium(cid) then
selfSay('Compre vip antes, depois eu lhe promoverei.')
talk_state = 0
else
selfSay('Voce quer ser promovido por 20k?')
talk_state = 1
end
elseif msgcontains(msg, 'premium') or msgcontains(msg, 'vip') then
selfSay('Você quer comprar Premium?')
talk_state = 2
elseif talk_state == 1 then
if msgcontains(msg, 'yes') then
if pay(cid,20000) then
doPlayerSetVocation(cid, getPlayerVocation(cid)+4)
selfSay('Voce foi promovido!')
else
selfSay('Voce nao tem dinheiro suficiente.')
end
end
talk_state = 0
elseif talk_state == 2 then
if msgcontains(msg, 'yes') then
if doPlayerRemoveItem(cid,2159,50) == TRUE then
addPremium(cid, 30)
selfSay('Voce recebeu 30 dias de premium!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'shield of honor') then
if doPlayerRemoveItem(cid,2159,200) == TRUE then
doPlayerAddItem(cid,2535,1)
selfSay('Voce recebeu Shield of Honor!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'helmet of honor') then
if doPlayerRemoveItem(cid,2159,50) == TRUE then
doPlayerAddItem(cid,2506,1)
selfSay('Voce recebeu Helmet of Honor!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'armor of honor') then
if doPlayerRemoveItem(cid,2159,50) == TRUE then
doPlayerAddItem(cid,2505,1)
selfSay('Voce recebeu Armor of Honor!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'legs of honor') then
if doPlayerRemoveItem(cid,2159,50) == TRUE then
doPlayerAddItem(cid,2507,1)
selfSay('Voce recebeu Legs of Honor!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'sword of honor') then
if doPlayerRemoveItem(cid,2159,200) == TRUE then
doPlayerAddItem(cid,7382,1)
selfSay('Voce recebeu Sword of Honor!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'axe of honor') then
if doPlayerRemoveItem(cid,2159,200) == TRUE then
doPlayerAddItem(cid,7388,1)
selfSay('Voce recebeu Axe of Honor!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'club of honor') then
if doPlayerRemoveItem(cid,2159,200) == TRUE then
doPlayerAddItem(cid,7392,1)
selfSay('Voce recebeu Club of Honor!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'damage ring') then
if doPlayerRemoveItem(cid,2159,150) == TRUE then
doPlayerAddItem(cid,2210,1)
selfSay('Voce recebeu Damage Ring!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'warrior ring') then
if doPlayerRemoveItem(cid,2159,150) == TRUE then
doPlayerAddItem(cid,2211,1)
selfSay('Voce recebeu Warrior Ring!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'magician ring') then
if doPlayerRemoveItem(cid,2159,150) == TRUE then
doPlayerAddItem(cid,2212,1)
selfSay('Voce recebeu Magician Ring!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'flames sword') then
if doPlayerRemoveItem(cid,2159,250) == TRUE then
doPlayerAddItem(cid,7748,1)
selfSay('Voce recebeu Flames Sword!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'united axe') then
if doPlayerRemoveItem(cid,2159,250) == TRUE then
doPlayerAddItem(cid,7751,1)
selfSay('Voce recebeu United Axe!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
if msgcontains(msg, 'quero tal item') then
if doPlayerRemoveItem(cid,id,quantidade) == TRUE then
doPlayerAddItem(cid,7756,1)
selfSay('Voce recebeu seu item!')
else
selfSay('Voce nao tem dinheiro!')
end
end
if msgcontains(msg, 'onyx arrow') then
if doPlayerRemoveItem(cid,2159,200) == TRUE then
doPlayerAddItem(cid,7365,1)
selfSay('Voce recebeu Onix Arrow!')
else
selfSay('Sorry, you do not have scarab Coins.')
end
end
talk_state = 0
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
doNpcSetCreatureFocus(focus)
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 4 then
selfSay('Good bye then.')
focus = 0
end
end
end
Editando:
-Vermelho: Mensagem que o player irá falar.
-Verde Escuro: Mensagem que o npc ira responder.
-Marrom: Função para falar o nome do player.
-Laranja: Mensagem do player para comprar vip.
-Roxo: Mensagem que o npc ira responder.
-Verde claro: Id do item (que ira custar o premium)
-Rosa: Quantidade do item id.
-Azul escuro: Quantidade de dias premium.
-Azul claro: Fala do npc ao comprar premium.
-Cinza: Fala do npc ao cancelar (quando player não tem o dinheiro suficiente).
-Salmão: Mensagem para comprar item.
-Teal: Id do item / Quantidade (preço).
-Dourado: Item que irá receber e quantidade.
-Pale turques: Mensagem de confirmação (quando tem dinheiro)
-Light Blue: Mensagem de negação (quando não tem dinheiro)
Obs: Vários items estão no tutorial bastando apenas edita-los, também possui função de promotion.
Itens por: Medicalghosr
Creditos:
Funções by: MUTAN0
Script e tutorial by: Newtonnotwen






info
Grupo: Campones
Registrado: 15/02/08
Posts: 72
Reputação: 0
Bom o nome do tópico já diz tudo hehehehe
mas é basicamente isso quero um npc que venda vários itens porem a moeda de compra seja o Golden Nugget em vez de gold.
Por exemplo o npc vende a VIP ROD por 7 golden nugget, VIP WAND por 7 Golden e VIP armor por 5 golden nugget.
mas quero saber como configurar por que esse npc vai vender todos os itens VIP do OT.