Ir para conteúdo

[Encerrado] [Pedido]Npc Que Troca Diamond Por Vip Days


Kurobisu

Posts Recomendados

Aqui tem um, tinha no server do slicer '-'

 

 

 

 

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

 

local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid

 

-- Conversa Jogador/NPC

if(msgcontains(msg, 'offer') or msgcontains(msg, 'Offer')) then

selfSay('I sell Premium accounts.', cid)

elseif(msgcontains(msg, 'premium account') or msgcontains(msg, 'Premium Account')) then

selfSay('Premium Account users are able to use ride, teleport and fly. They can also wear all clothes, rent houses and costumize poké balls. Finally, premium account users have access to the saffari zone and are free of taxes in the casino! If you would like to upgrade your account for a month you will have to pay me 10 diamonds. Would you like to upgrade it?', cid)

talkState[talkUser] = 1

elseif(msgcontains(msg, 'bless') or msgcontains(msg, 'Bless')) then

selfSay('To be blessed 3 diamonds are necessary, would you like to go on?', cid)

talkState[talkUser] = 2

elseif(msgcontains(msg, 'Change Sex') or msgcontains(msg, 'change sex')) then

selfSay('To change sex 5 diamonds are necessary, would you like to go on?', cid)

talkState[talkUser] = 3

elseif(msgcontains(msg, 'Hometown') or msgcontains(msg, 'hometown')) then

selfSay('To change your hometown five diamonds are needed, what the city wants to choose?', cid)

talkState[talkUser] = 4

 

-- Confirmação da Compra

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then

if(doPlayerRemoveItem(cid, 6527, 10) == true) then

selfSay('Thanks!', cid)

doPlayerAddPremiumDays(cid, 30)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then

if getPlayerBlessing(cid, 1) and getPlayerBlessing(cid, 2) and getPlayerBlessing(cid, 3) and getPlayerBlessing(cid, 4) and getPlayerBlessing(cid, 5) then

selfSay('You have already got one or more blessings!', cid)

else

if(doPlayerRemoveItem(cid, 2145, 3) == true) then

selfSay('Thanks!', cid)

doPlayerAddBlessing(cid, 1)

doPlayerAddBlessing(cid, 2)

doPlayerAddBlessing(cid, 3)

doPlayerAddBlessing(cid, 4)

doPlayerAddBlessing(cid, 5)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

end

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

if(getPlayerSex(cid) == PLAYERSEX_FEMALE) then

doPlayerSetSex(cid, PLAYERSEX_MALE)

else

doPlayerSetSex(cid, PLAYERSEX_FEMALE)

end

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'saffron') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 1)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'cerulean') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 2)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'lavender') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 3)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'fuchsia') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 4) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 4)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'celadon') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 5)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'viridian') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 6)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'pewter') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 8)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'vermilion') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 9)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'cinnabar') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 10)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

end

return TRUE

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Link para o comentário
Compartilhar em outros sites

Explicar como coloca ele?

vai em data/npc/

Cria um arquivo .XML chamado premium.xml

e coloca isso dentro:


<?xml version="1.0" encoding="UTF-8"?>
<npc name="Dalk" script="scripts/premium.lua" walkinterval="3000" floorchange="0" access="5" >
<health now="150" max="150"/>
<look type="522" head="0" body="114" legs="114" feet="0"/>
<parameters>
<parameter key="message_greet" value="Welcome to the diamond store, here you are able to upgrade your account to 'premium account' (10D), change your 'hometown'(5D), 'change sex'(5D) and 'bless'(3D)."/>
<parameter key="message_farewell" value="Bye! See you next time."/>
</parameters>
</npc>

 

E depois vai em data/npcs/scripts

 

e cria um arquivo.LUA chamado premium

 

 

E cola o que tem no spoiler lá emcima...

 

 

Se for pra como ele funciona.. diz ai que tento explicar tambem

Link para o comentário
Compartilhar em outros sites

Vou explicar no script mesmo ok? vou colocar no lado de cada 1 -- EXPLICAÇÃO

 

Ai posto.. peria

 

Aqui ó o script todo explicado ^^

 

 

 

 

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

 

local talkUser = NPCHANDLER_CONVbehavior == CONVERSATION_DEFAULT and 0 or cid

 

-- Conversa Jogador/NPC

if(msgcontains(msg, 'offer') or msgcontains(msg, 'Offer')) then -- O que o player vai falar depois do HI

selfSay('I sell Premium accounts.', cid) -- o que o npc vai falar

elseif(msgcontains(msg, 'premium account') or msgcontains(msg, 'Premium Account')) then-- O que o player vai falar depois do HI

selfSay('Premium Account users are able to use ride, teleport and fly. They can also wear all clothes, rent houses and costumize poké balls. Finally, premium account users have access to the saffari zone and are free of taxes in the casino! If you would like to upgrade your account for a month you will have to pay me 10 diamonds. Would you like to upgrade it?', cid)-- o que o npc vai falar

talkState[talkUser] = 1

elseif(msgcontains(msg, 'bless') or msgcontains(msg, 'Bless')) then-- O que o player vai falar depois do HI

selfSay('To be blessed 3 diamonds are necessary, would you like to go on?', cid) -- o que o npc vai falar

talkState[talkUser] = 2

elseif(msgcontains(msg, 'Change Sex') or msgcontains(msg, 'change sex')) then-- O que o player vai falar depois do HI

selfSay('To change sex 5 diamonds are necessary, would you like to go on?', cid) -- o que o npc vai falar

talkState[talkUser] = 3

elseif(msgcontains(msg, 'Hometown') or msgcontains(msg, 'hometown')) then-- O que o player vai falar depois do HI

selfSay('To change your hometown five diamonds are needed, what the city wants to choose?', cid) -- o que o npc vai falar

talkState[talkUser] = 4

 

-- Confirmação da Compra

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 1) then -- Se o player falar YES no premium account

if(doPlayerRemoveItem(cid, 6527, 10) == true) then -- vai remover o item do player ( 6527 ) 10 unidades

selfSay('Thanks!', cid) -- vNpc vai falar isso

doPlayerAddPremiumDays(cid, 30) -- vai dar ao player 30 dias de premium

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid) --- se nao tiver grana vai falar isso

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 2) then -- se falar yes no blesss

if getPlayerBlessing(cid, 1) and getPlayerBlessing(cid, 2) and getPlayerBlessing(cid, 3) and getPlayerBlessing(cid, 4) and getPlayerBlessing(cid, 5) then -- vai verificar se o player já NAO TEM todas...

selfSay('You have already got one or more blessings!', cid) -- se ele tiver vai falar isso

else

if(doPlayerRemoveItem(cid, 2145, 3) == true) then -- se nao tiver ele vai tirar do player o item(2145 ) 3 unidades

selfSay('Thanks!', cid) -- vai falar isso

doPlayerAddBlessing(cid, 1) --vai dar ao player a bless1

doPlayerAddBlessing(cid, 2) --vai dar ao player a bless2

doPlayerAddBlessing(cid, 3) --vai dar ao player a bless3

doPlayerAddBlessing(cid, 4) --vai dar ao player a bless4

doPlayerAddBlessing(cid, 5) --vai dar ao player a bles5

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid) -- se nao tiver a grana ou item vai falar isso

talkState[talkUser] = 0

end

end

elseif(msgcontains(msg, 'yes') and talkState[talkUser] == 3) then -- se falar yes no changesex

if(doPlayerRemoveItem(cid, 2145, 5) == true) then -- remover o item dnv~~

selfSay('Thanks!', cid) --npc falar

if(getPlayerSex(cid) == PLAYERSEX_FEMALE) then-- SE o sexo do player for FEMALE...

doPlayerSetSex(cid, PLAYERSEX_MALE)--- vai transformar para MALE

else -- E SE for MALE

doPlayerSetSex(cid, PLAYERSEX_FEMALE) -- vai transforma pra FEMALE

end

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid) -- se nao tiver os itens...

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'saffron') and talkState[talkUser] == 4) then -- AGORA é das cidades... se a mensagem for saffron

if(doPlayerRemoveItem(cid, 2145, 5) == true) then -- verifica os itens e remove

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 1) -- muda a cidade do player pra TOWN 1 que seria SAFRFON // o resto é mesma coisa...

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'cerulean') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 2)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'lavender') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 3)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'fuchsia') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 4) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 4)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'celadon') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 5)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'viridian') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 6)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'pewter') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 8)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'vermilion') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 9)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

elseif(msgcontains(msg, 'cinnabar') and talkState[talkUser] == 4) then

if(doPlayerRemoveItem(cid, 2145, 5) == true) then

selfSay('Thanks!', cid)

doPlayerSetTown(cid, 10)

talkState[talkUser] = 0

else

selfSay('You do not have enough diamonds.', cid)

talkState[talkUser] = 0

end

end

return TRUE

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Link para o comentário
Compartilhar em outros sites

  • 5 years later...
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.
Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...