Ir para conteúdo

[Encerrado] Npc bless


mateus900

Posts Recomendados

dalk.lua

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, 'trade')) then
selfSay('Eu vendo: Premium Account, Change Sex e Change Hometown.', cid)
elseif(msgcontains(msg, 'premium account') or msgcontains(msg, 'Premium Account')) then
selfSay('Os usuarios de contas VIP sao capazes de usar as habilidades exclusivos para seus pokemon como: teleport, ride, fly e outras coisas, bem, esse serviço custa 10 Diamonds, voce quer atualizar a sua conta?', cid)
talkState[talkUser] = 1
elseif(msgcontains(msg, 'bless') or msgcontains(msg, 'Bless')) then
selfSay('Para comprar bless, são necessárias 3 Diamonds, voce gostaria de ir em frente?', 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, 'Change Hometown') or msgcontains(msg, 'change 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, 2145, 10) == true) then
selfSay('Foi adicionado 30 dias de VIP na sua conta!', 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('You have been blessed.', 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('I changex your sex, enjoy ur new life', 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('You now live on Saffron!', cid)
doPlayerSetTown(cid, 1)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
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('You now live on Cerulean!', cid)
doPlayerSetTown(cid, 2)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
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('You now live on Cinnabar!', cid)
doPlayerSetTown(cid, 3)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
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('You now live on Vermilion!', cid)
doPlayerSetTown(cid, 4)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
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, 5) == true) then
selfSay('You now live on Fuchsia!', cid)
doPlayerSetTown(cid, 5)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
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('You now live on Celadon!', cid)
doPlayerSetTown(cid, 6)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
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('You now live on Pewter!', cid)
doPlayerSetTown(cid, 7)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
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('You now live on Viridian!', cid)
doPlayerSetTown(cid, 9)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
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('You now live on Lavender!', cid)
doPlayerSetTown(cid, 10)
doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
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())

Para comprar os itens:

premium account <- 10 Diamonds
bless <- 3 Diamonds
change sex <- 5 Diamonds
change hometown <- Trocar de cidade <- 5 Diamonds
Link para o comentário
Compartilhar em outros sites

 

dalk.lua

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, 'trade')) then

selfSay('Eu vendo: Premium Account, Change Sex e Change Hometown.', cid)

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

selfSay('Os usuarios de contas VIP sao capazes de usar as habilidades exclusivos para seus pokemon como: teleport, ride, fly e outras coisas, bem, esse serviço custa 10 Diamonds, voce quer atualizar a sua conta?', cid)

talkState[talkUser] = 1

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

selfSay('Para comprar bless, são necessárias 3 Diamonds, voce gostaria de ir em frente?', 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, 'Change Hometown') or msgcontains(msg, 'change 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, 2145, 10) == true) then

selfSay('Foi adicionado 30 dias de VIP na sua conta!', 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('You have been blessed.', 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('I changex your sex, enjoy ur new life', 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('You now live on Saffron!', cid)

doPlayerSetTown(cid, 1)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

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('You now live on Cerulean!', cid)

doPlayerSetTown(cid, 2)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

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('You now live on Cinnabar!', cid)

doPlayerSetTown(cid, 3)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

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('You now live on Vermilion!', cid)

doPlayerSetTown(cid, 4)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

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, 5) == true) then

selfSay('You now live on Fuchsia!', cid)

doPlayerSetTown(cid, 5)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

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('You now live on Celadon!', cid)

doPlayerSetTown(cid, 6)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

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('You now live on Pewter!', cid)

doPlayerSetTown(cid, 7)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

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('You now live on Viridian!', cid)

doPlayerSetTown(cid, 9)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

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('You now live on Lavender!', cid)

doPlayerSetTown(cid, 10)

doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))

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())

Para comprar os itens:

premium account <- 10 Diamonds
bless <- 3 Diamonds
change sex <- 5 Diamonds
change hometown <- Trocar de cidade <- 5 Diamonds

vlw

Link para o comentário
Compartilhar em outros sites

  • 4 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...