Ir para conteúdo

Npc Promotion Dando Erro!


jacksucuri

Posts Recomendados

NPC promotion dando erro!

 

vo posta aqui:

14:48 King Johnny: Welcome, GOD PauloO! I have been expecting you.

14:48 GOD PauloO [302]: promotion

14:48 King Johnny: Posso te promover por 20000 moedas de ouro... Gostaria de ser promovido?

14:48 GOD PauloO [302]: yes

14:48 King Johnny: You are already promoted!

 

Mas num recebe promotion! (testei com char q não e GOD.. char q eu criei no acc manager e msmo assim ele num recebe promotion)

 

Alguem pode me ajudar a arruma isso ou postar um novo npc promotion...

 

Obrigadu!

Link para o comentário
Compartilhar em outros sites

Tente colocar isso no seu Npc de promotion:

 

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

--[[

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

node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 500000, level = 150, promotion = 2, text = 'Congratulations! You are now henzen vocation.'})

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

]]--

 

npcHandler:addModule(FocusModule:new())

 

Se não conseguir poste aqui o script do seu Npc de promotion, para nós verificarmos o erro.

 

Abraços.

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

Nem Deu certo

 

olha o scrip ai :

 

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('Hello ' .. creatureGetName(cid) .. '! I sell premiums and promotions.')

focus = cid

talk_start = os.clock()

 

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then

selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

 

elseif focus == cid then

talk_start = os.clock()

 

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

if getPlayerVocation(cid) > 4 then

selfSay('Sorry, you are already promoted.')

talk_state = 0

elseif getPlayerLevel(cid) < 20 then

selfSay('Sorry, you need level 20 to buy promotion.')

talk_state = 0

elseif not isPremium(cid) then

selfSay('Sorry, you must be premium to buy promotion.')

talk_state = 0

else

selfSay('Do you want to buy promotion for 20k?')

talk_state = 1

end

 

elseif msgcontains(msg, 'premium') or msgcontains(msg, 'premmy') then

selfSay('Do you want to buy 7 days of premium for 7k?')

talk_state = 2

 

elseif talk_state == 1 then

if msgcontains(msg, 'yes') then

if pay(cid,20000) then

doPlayerSetVocation(cid, getPlayerVocation(cid)+4)

selfSay('You are now promoted!')

else

selfSay('Sorry, you do not have enough money.')

end

end

talk_state = 0

 

elseif talk_state == 2 then

if msgcontains(msg, 'yes') then

if pay(cid,7000) then

selfSay('/premium '.. creatureGetName(cid) ..', 7')

selfSay('You have 7 days of premium more!')

else

selfSay('Sorry, you do not have enough money.')

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) > 5 then

selfSay('Good bye then.')

focus = 0

end

end

end

 

ajuda...

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
  • Quem Está Navegando   0 membros estão online

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