Ir para conteúdo
  • 0

Promotion some ao logar


sergionilo

Pergunta

não consegui encontrar em nenhum topico antigo a resposta para essa questao só sei que o promotion some ao logar sendo q tem 2 promotions no meu ot vai ai o script do 1 promotion, 2 promotion, e vocation.xml :

 

1 promotion npc.lua script :

 

 

 

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

local price = 20000000

local vocations = {1,2,3,4}

if(msgcontains(msg, 'promotion') or msgcontains(msg, 'member promotion')) then

selfSay('Você quer ser promovido member por '..price..' moedas? {yes} ', cid)

talkState[talkUser] = 1

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

if isInArray(vocations, getPlayerVocation(cid)) then

if doPlayerRemoveMoney(cid,price) == TRUE then

if getPlayerVocation(cid) == 1 then doPlayerSetVocation(cid, 5)

end

 

if getPlayerVocation(cid) == 2 then doPlayerSetVocation(cid, 6)

end

 

 

if getPlayerVocation(cid) == 3 then doPlayerSetVocation(cid, 7)

end

 

if getPlayerVocation(cid) == 4 then doPlayerSetVocation(cid, 8)

end

selfSay('Parabens! Você foi promovido member! ', cid)

talkState[talkUser] = 0

else

selfSay('Você não tem ' .. price .. ' moedas para ser promovido member...', cid)

talkState[talkUser] = 0

end

else

selfSay('Desculpe, você precisa ter a primeira promotion para ser promovido member.', cid)

talkState[talkUser] = 0

end

elseif msg == "no" and talkState[talkUser] >= 1 then

selfSay("Then not", cid)

talkState[talkUser] = 0

npcHandler:releaseFocus(cid)

end

return TRUE

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

2 promotion npc.lua script :

 

 

 

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

local price = 80000000

local vocations = {5,6,7,8}

if(msgcontains(msg, 'promotion') or msgcontains(msg, 'vip promotion')) then

selfSay('Você quer ser promovido vip por '..price..' moedas? {yes} ', cid)

talkState[talkUser] = 1

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

if isInArray(vocations, getPlayerVocation(cid)) then

if doPlayerRemoveMoney(cid,price) == TRUE then

if getPlayerVocation(cid) == 5 then doPlayerSetVocation(cid, 9)

end

 

if getPlayerVocation(cid) == 6 then doPlayerSetVocation(cid, 10)

end

 

 

if getPlayerVocation(cid) == 7 then doPlayerSetVocation(cid, 11)

end

 

if getPlayerVocation(cid) == 8 then doPlayerSetVocation(cid, 12)

end

selfSay('Parabens! Você foi promovido vip! ', cid)

talkState[talkUser] = 0

else

selfSay('Você não tem ' .. price .. ' moedas para ser promovido vip...', cid)

talkState[talkUser] = 0

end

else

selfSay('Desculpe, você precisa ter a member promotion para ser promovido vip.', cid)

talkState[talkUser] = 0

end

elseif msg == "no" and talkState[talkUser] >= 1 then

selfSay("Then not", cid)

talkState[talkUser] = 0

npcHandler:releaseFocus(cid)

end

return TRUE

end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

 

 

Vocation.xml :

 

 

<?xml version="1.0" encoding="UTF-8"?>

<vocations>

 

 

 

<vocation id="0" name="None" description="none" needpremium="0" gaincap="5" gainhp="5" gainmana="5" gainhpticks="3" gainhpamount="1" gainmanaticks="6" gainmanaamount="1" manamultiplier="4.0" attackspeed="2000" soulmax="100" gainsoulticks="120" fromvoc="0" attackable="no">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="1" name="Master Sorcerer" description="a master sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="50" gainmanaticks="2" gainmanaamount="100" manamultiplier="1.1" attackspeed="1500" soulmax="100" gainsoulticks="120" fromvoc="1">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="2" name="Elder Druid" description="a elder druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="50" gainmanaticks="2" gainmanaamount="100" manamultiplier="1.1" attackspeed="1500" soulmax="100" gainsoulticks="120" fromvoc="2">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="3" name="Royal Paladin" description="a royal paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="50" gainmanaticks="2" gainmanaamount="100" manamultiplier="1.4" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="3">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="4" name="Elite Knight" description="a elite knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="50" gainmanaticks="2" gainmanaamount="100" manamultiplier="3.0" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="4">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

 

 

 

<vocation id="5" name="Member Sorcerer" description="a member sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="100" gainmanaticks="2" gainmanaamount="200" manamultiplier="1.1" attackspeed="1500" soulmax="100" gainsoulticks="120" fromvoc="1">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="6" name="Member Druid" description="a member druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="100" gainmanaticks="2" gainmanaamount="200" manamultiplier="1.1" attackspeed="1500" soulmax="100" gainsoulticks="120" fromvoc="2">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="7" name="Member Paladin" description="a member paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="100" gainmanaticks="2" gainmanaamount="200" manamultiplier="1.4" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="3">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="8" name="Member Knight" description="a member knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="100" gainmanaticks="2" gainmanaamount="200" manamultiplier="3.0" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="4">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

 

 

 

<vocation id="9" name="Vip Sorcerer" description="a vip sorcerer" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="150" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.1" attackspeed="1500" soulmax="100" gainsoulticks="120" fromvoc="5">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="2.0" sword="2.0" axe="2.0" distance="2.0" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="10" name="Vip Druid" description="a vip druid" needpremium="0" gaincap="10" gainhp="5" gainmana="30" gainhpticks="3" gainhpamount="150" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.1" attackspeed="1500" soulmax="100" gainsoulticks="120" fromvoc="6">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.5" club="1.8" sword="1.8" axe="1.8" distance="1.8" shielding="1.5" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="11" name="Vip Paladin" description="a vip paladin" needpremium="0" gaincap="20" gainhp="10" gainmana="15" gainhpticks="3" gainhpamount="150" gainmanaticks="2" gainmanaamount="300" manamultiplier="1.4" attackspeed="1200" soulmax="100" gainsoulticks="7" fromvoc="7">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.2" club="1.2" sword="1.2" axe="1.2" distance="1.1" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

<vocation id="12" name="Vip Knight" description="a vip knight" needpremium="0" gaincap="25" gainhp="15" gainmana="5" gainhpticks="3" gainhpamount="150" gainmanaticks="2" gainmanaamount="300" manamultiplier="3.0" attackspeed="1200" soulmax="100" gainsoulticks="120" fromvoc="8">

<formula meleeDamage="1.0" distDamage="1.0" wandDamage="1.0" magDamage="1.0" magHealingDamage="1.0" defense="1.0" magDefense="1.0" armor="1.0"/>

<skill fist="1.1" club="1.1" sword="1.1" axe="1.1" distance="1.4" shielding="1.1" fishing="1.1" experience="1.0"/>

</vocation>

 

 

 

-->

</vocations>

 

 

por favor galera meu ot ta quase pronto e me veio esse erro que eu não sei oq fazer, quem ajudar ganha +++++ REP !

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

Tenta assim, deixa só 1 NPC, e coloca isso dentro:

 

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

NpcSystem.parseParameters(npcHandler)

 

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

 

local node1 = keywordHandler:addKeyword({'member promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})

node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})

node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

--[[

local node2 = keywordHandler:addKeyword({'vip promotion'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 80000000 gold coins. Do you want me to epicize you?'})

node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 80000000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})

node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

]]--

 

npcHandler:addModule(FocusModule:new())

 

 

 

 

Para promover a primeira fala "member promotion" sem as aspas e a segunda diga "vip promotion"

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...