Ir para conteúdo

Bug Second Promote


lanzah

Posts Recomendados

nãoo, eu tenho um npc e ele muda.

 

ta ae o script do npc:

 

local keywordHandler = KeywordHandler:new()

local npcHandler = NpcHandler:new(keywordHandler)

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 a = {

[5] = {new_voc = 9,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true},

[6] = {new_voc = 10,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true},

[7] = {new_voc = 11,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true},

[8] = {new_voc = 12,need_level = true,level = 60,cobrar = true,price = 100000,need_premium = true}

}

local b = a[getPlayerVocation(cid)]

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

if(not b) then

selfSay('Você não tem a second promote, então não poderá ser promovido!.', cid)

talkState[talkUser] = 0

else

selfSay('Deseja virar ' .. getVocationInfo(b.new_voc).name .. ' por '..b.price..' gold coins? {yes}', cid)

talkState[talkUser] = 1

end

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

if b.need_premium == true and not isPremium(cid) then

selfSay('Você precisa ser Premium para ser promovido!.', cid)

talkState[talkUser] = 0

elseif b.need_level == true and getPlayerLevel(cid) < b.level then

selfSay('Você deve ter pelo menos level '.. b.level ..' para ser promovido!.', cid)

talkState[talkUser] = 0

elseif b.cobrar == true and doPlayerRemoveMoney(cid, b.price) == TRUE then

doPlayerSetVocation(cid,b.new_voc)

selfSay('Você foi promovido com sucesso.', cid)

talkState[talkUser] = 0

else

selfSay('Você não tem '..b.price..' gold coins Suficientes.', cid)

doSendMagicEffect(getPlayerPosition(cid), 2)

end

end

return TRUE

end

 

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)

npcHandler:addModule(FocusModule:new())

Link para o comentário
Compartilhar em outros sites

tenta isso aqui

 

 

esse ai e promotion tpw

sorcerer vira master sorcerer etc..

 

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({'promot'}, 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 = 20000, 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})

 

npcHandler:addModule(FocusModule:new())

 

 

 

Promotion

ex: master sorcerer vira epic sorcerer etc.. de acordo com sua vocation.xml

 

 

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({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to second promote you?'})

node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 2, 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})

 

npcHandler:addModule(FocusModule:new())

 

 

 

AJUDEI? REP+

Editado por lfelipebsilva05
Link para o comentário
Compartilhar em outros sites

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
×
×
  • Criar Novo...