Ir para conteúdo

Featured Replies

Postado

Eu tenho uma script de promotion feito pelo amigo @Sttorm e eu queria adicionar mais uma coisa nela que é 

para quando o player fazer a promotion ele foce para o nivel 1 feito uma Reborn"reset"

Script:

 

local t  = {

[569] = {570, 1020, 3000, 3000}, 
}

local itemid, count = 8306 , 1
local level = 1500

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)
local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
local a = t[getPlayerVocation(cid)]

      if msgcontains(msg, "mystic promotion") then
         if a then
            if getPlayerLevel(cid) >= level then 
               if doPlayerRemoveItem(cid, itemid, count) then
local outfit = {lookType = a[2]}
                  doPlayerSetVocation(cid, a[1])
                  doCreatureChangeOutfit(cid, outfit)
                  setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + a[3])
                  setCreatureMaxMana(cid, getCreatureMaxMana(cid) + a[4])
                  addEvent(doRemoveCreature, 1000, cid)
               else
                   selfSay('Voce precisa de '.. count ..' '.. getItemInfo(itemid).name ..' para fazer a Mystic Promotion.', cid)
               end
            else
                selfSay('Você precisa estar no level '.. level ..'.', cid)
            end
         else
             selfSay('Sua Vocation não tem Promotion disponivel, Voce Precisa estar na ultima Transform!', cid)
         end   
      return true
      end
end                
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Resolvido por Storm

Ir para solução
  • Respostas 6
  • Visualizações 390
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • @Jociel  local t = { [569] = {570, 1020, 3000, 3000}, } local itemid, count = 8306 , 1 local level = 1500 local newlevel = 1 -- Level apos resetar local keywordHandler = KeywordHandler

  • @Jociel  local t = { [569] = {570, 1020, 3000, 3000}, } local itemid, count = 8306 , 1 local level = 1500 local newlevel = 1 -- Level apos resetar local keywordHandler = KeywordHandler

  • @Jociel Troca essa parte ; if getPlayerLevel(cid) >= level then Se você quiser que a promotion só seja feita no level que você indicou if getPlayerLevel(cid) == level then Se você qui

Postado

@Jociel 

local t = {
    
    [569] = {570, 1020, 3000, 3000}, 
}

local itemid, count = 8306 , 1
local level = 1500
local newlevel = 1 -- Level apos resetar

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)
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local a = t[getPlayerVocation(cid)]
    local playerid = getPlayerGUID(cid)
    if msgcontains(msg, "mystic promotion") then
        if a then
            if getPlayerLevel(cid) >= level then 
                if doPlayerRemoveItem(cid, itemid, count) then
                    local outfit = {lookType = a[2]}
                    doPlayerSetVocation(cid, a[1])
                    doCreatureChangeOutfit(cid, outfit)
                    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + a[3])
                    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + a[4])
                    db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
                    addEvent(doRemoveCreature, 1000, cid)
                else
                    selfSay('Voce precisa de '.. count ..' '.. getItemInfo(itemid).name ..' para fazer a Mystic Promotion.', cid)
                end
            else
                selfSay('Você precisa estar no level '.. level ..'.', cid)
            end
        else
            selfSay('Sua Vocation não tem Promotion disponivel, Voce Precisa estar na ultima Transform!', cid)
        end 
        return true
    end
end 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Postado
  • Autor
  Em 01/06/2018 em 16:51, Sttorm disse:

@Jociel 

local t = {
    
    [569] = {570, 1020, 3000, 3000}, 
}

local itemid, count = 8306 , 1
local level = 1500
local newlevel = 1 -- Level apos resetar

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)
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local a = t[getPlayerVocation(cid)]
    local playerid = getPlayerGUID(cid)
    if msgcontains(msg, "mystic promotion") then
        if a then
            if getPlayerLevel(cid) >= level then 
                if doPlayerRemoveItem(cid, itemid, count) then
                    local outfit = {lookType = a[2]}
                    doPlayerSetVocation(cid, a[1])
                    doCreatureChangeOutfit(cid, outfit)
                    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + a[3])
                    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + a[4])
                    db.executeQuery("UPDATE `players` SET `level`="..newlevel..",`experience`= 0 WHERE `players`.`id`= ".. playerid .."")
                    addEvent(doRemoveCreature, 1000, cid)
                else
                    selfSay('Voce precisa de '.. count ..' '.. getItemInfo(itemid).name ..' para fazer a Mystic Promotion.', cid)
                end
            else
                selfSay('Você precisa estar no level '.. level ..'.', cid)
            end
        else
            selfSay('Sua Vocation não tem Promotion disponivel, Voce Precisa estar na ultima Transform!', cid)
        end 
        return true
    end
end 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

  

O player faz a promotion normalmente porem nao reseta o lvl dele e nao consta nenhum erro na distro!

Postado
  • Solução

@Jociel 

local t = {
    
    [569] = {570, 1020, 3000, 3000}, 
}

local itemid, count = 8306 , 1
local level = 1500
local newlevel = 1 -- Level apos resetar

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)
    local talkUser = NPCHANDLER_CONVBEHAVIOR == CONVERSATION_DEFAULT and 0 or cid
    local a = t[getPlayerVocation(cid)]
    if msgcontains(msg, "mystic promotion") then
        if a then
            if getPlayerLevel(cid) >= level then 
                if doPlayerRemoveItem(cid, itemid, count) then
                    local outfit = {lookType = a[2]}
                    doPlayerSetVocation(cid, a[1])
                    doCreatureChangeOutfit(cid, outfit)
                    setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + a[3])
                    setCreatureMaxMana(cid, getCreatureMaxMana(cid) + a[4])
                    doPlayerAddLevel(cid, -(getPlayerLevel(cid) - newlevel))
                    addEvent(doRemoveCreature, 1000, cid)
                else
                    selfSay('Voce precisa de '.. count ..' '.. getItemInfo(itemid).name ..' para fazer a Mystic Promotion.', cid)
                end
            else
                selfSay('Você precisa estar no level '.. level ..'.', cid)
            end
        else
            selfSay('Sua Vocation não tem Promotion disponivel, Voce Precisa estar na ultima Transform!', cid)
        end 
        return true
    end
end 
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

 

Participe da conversa

Você pode postar agora e se cadastrar mais tarde. Se você tem uma conta, faça o login para postar com sua conta.

Visitante
Responder

Quem Está Navegando 0

  • Nenhum usuário registrado visualizando esta página.

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.7k

Informação Importante

Confirmação de Termo