Ir para conteúdo
  • 0

Dar Iten Para X Level Para Cada Vocação!


leandroskt8

Pergunta

quero um script quando player pegar x level ganhar x iten para cada vocação o x iten diferente Obg! valendo repbutton_ok.png

 

Tenho esse script só que ta dando erro alguem me ajuda ai pf.

 

local configuracao = {
efeito = {27,28, 29,79}, -- Efeito que vai mandar ao avançar de level.
}
function onAdvance(cid, skill, oldLevel, newLevel)
if getPlayerStorageValue(cid, 25686) >= 1 or getPlayerStorageValue(cid, 25687) >= 1 then return true end
if (getPlayerLevel(cid) == 150) then
doPlayerAddItem(cid, 7424, 1)
doSendMagicEffect(getThingPos(cid), configuracao.efeito[math.random(#configuracao.efeito)])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, )
setPlayerStorageValue(cid, 25686, 1)
elseif (getPlayerLevel(cid) == 150) and getPlayerVocation(cid) == 4, 8, 12 then -- vocações
doPlayerAddItem(cid, 115, 1)
doSendMagicEffect(getThingPos(cid), configuracao.efeito[math.random(#configuracao.efeito)])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, )
setPlayerStorageValue(cid, 25687, 1)
elseif (getPlayerLevel(cid) == 150) and getPlayerVocation(cid) == 3, 7, 11 then -- vocações
doPlayerAddItem(cid, 2352, 1)
doPlayerAddItem(cid, 7438, 1)
doSendMagicEffect(getThingPos(cid), configuracao.efeito[math.random(#configuracao.efeito)])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, )
setPlayerStorageValue(cid, 25687, 1)
elseif (getPlayerLevel(cid) == 150) and getPlayerVocation(cid) == 2, 10, 6 then -- vocações
doPlayerAddItem(cid, 7424, 1)
doSendMagicEffect(getThingPos(cid), configuracao.efeito[math.random(#configuracao.efeito)])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, )
setPlayerStorageValue(cid, 25687, 1)
elseif (getPlayerLevel(cid) == 150) and getPlayerVocation(cid) == 1, 5, 9 then -- vocações
doPlayerAddItem(cid, 7424, 1)
doSendMagicEffect(getThingPos(cid), configuracao.efeito[math.random(#configuracao.efeito)])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, )
setPlayerStorageValue(cid, 25687, 1)
end
return true
end

Link para o comentário
Compartilhar em outros sites

6 respostass a esta questão

Posts Recomendados

  • 0

Fiz um aqui:

 



local config = {
   [1] = {
       [100] = {
           {2160, 30},
       }
   },
   [2] = {
       [100] = {
           {2160, 30},
       }
   },
   [3] = {
       [100] = {
           {2160, 30}
       }
   },
   [4] = {
       [100] = {
           {2160, 30}
       }
   }
}

function onAdvance(cid, skill, oldLevel, newLevel)
   if skill == SKILL__LEVEL then
       local x = (config[getPlayerVocation(cid)] or config[getVocationInfo(getPlayerVocation(cid)).fromVocation])
       if not x then
           return true
       end

       local y = x[newLevel]
       if not y then
           return true
       end

       local items = ""
       local n = 1
       local gift
       for _, item in ipairs(y) do
           if type(item) == "table" then
               gift = doCreateItemEx(item[1], item[2])
               items = items .. (n == 1 and "" or ", ") .. item[2] .." ".. getItemNameById(item[1])
           else
               gift = doCreateItemEx(item, 1)
               items = items .. (n == 1 and "" or ", ") .. getItemNameById(item)
           end
           doPlayerAddItemEx(cid, gift, true)
           n = n + 1
       end
       doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You have received: ".. items ..".")
   end
   return true
end

 

Para configurar, basta mexer nessa tabela:

 


local config = {
   [1] = {
       [100] = {
           {2160, 30}
       }
   },
   [2] = {
       [100] = {
           {2160, 30},
           {2157, 3},
           2158
       }
   },
   [3] = {
       [100] = {
           {2160, 30}
       }
   },
   [4] = {
       [100] = {
           {2160, 30}
       }
   }
}

 

Ele já está pré-configurado para dar 30 crystal coins para qualquer vocação no level 100. Vamos agora a um exemplo básico, uma Magic Sword no level 300 para Knights.

 


local config = {
   [1] = {
       [100] = {
           {2160, 30}
       }
   },
   [2] = {
       [100] = {
           {2160, 30},
           {2157, 3},
           2158
       }
   },
   [3] = {
       [100] = {
           {2160, 30}
       }
   },
   [4] = {
       [100] = {
           {2160, 30}
       },
       [300] = {
           2400
       }
   }
}

 

O sistema suporta múltiplos itens, basta adicionar uma vírgula no fim de cada linha, com exceção da última.

 




   [1] = {
       [100] = {
           {2160, 30},
           1111,
           2222,
           3333,
           4444
       }

 

O sistema é inteligente e procura na tabela pela vocação-base de jogadores promovidos, então você não precisa adicionar outras vocações.

 

Abraços.

Link para o comentário
Compartilhar em outros sites

  • 0

esse escript ta sem strorage, quando cara more e volta level ele consege iten novamente quero que alguem me ajude com esse script aqui!

local configuracao = {
efeito = {27,28, 29,79}, -- Efeito que vai mandar ao avançar de level.
}
function onAdvance(cid, skill, oldLevel, newLevel)
if getPlayerStorageValue(cid, 25686) >= 1 or getPlayerStorageValue(cid, 25687) >= 1 then return true end
if (getPlayerLevel(cid) == 150) then
doPlayerAddItem(cid, 7424, 1)
doSendMagicEffect(getThingPos(cid), configuracao.efeito[math.random(#configuracao.efeito)])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, )
setPlayerStorageValue(cid, 25686, 1)
elseif (getPlayerLevel(cid) == 150) and getPlayerVocation(cid) == 4, 8, 12 then -- vocações
doPlayerAddItem(cid, 115, 1)
doSendMagicEffect(getThingPos(cid), configuracao.efeito[math.random(#configuracao.efeito)])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, )
setPlayerStorageValue(cid, 25687, 1)
elseif (getPlayerLevel(cid) == 150) and getPlayerVocation(cid) == 3, 7, 11 then -- vocações
doPlayerAddItem(cid, 2352, 1)
doPlayerAddItem(cid, 7438, 1)
doSendMagicEffect(getThingPos(cid), configuracao.efeito[math.random(#configuracao.efeito)])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, )
setPlayerStorageValue(cid, 25687, 1)
elseif (getPlayerLevel(cid) == 150) and getPlayerVocation(cid) == 2, 10, 6 then -- vocações
doPlayerAddItem(cid, 7424, 1)
doSendMagicEffect(getThingPos(cid), configuracao.efeito[math.random(#configuracao.efeito)])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, )
setPlayerStorageValue(cid, 25687, 1)
elseif (getPlayerLevel(cid) == 150) and getPlayerVocation(cid) == 1, 5, 9 then -- vocações
doPlayerAddItem(cid, 7424, 1)
doSendMagicEffect(getThingPos(cid), configuracao.efeito[math.random(#configuracao.efeito)])
doPlayerSendTextMessage(cid, MESSAGE_EVENT_ADVANCE, )
setPlayerStorageValue(cid, 25687, 1)
end
return true
end

 

preciso para essas vocações e esses itens .

 

Obg
happy.png Editado por godleandro
Link para o comentário
Compartilhar em outros sites

  • 0

se quer arrumar o script começa estudando um pouco do básico de LUA, porque sabendo o básico já saberia que essa coisa lamentável não existe:

 

 

 

and getPlayerVocation(cid) == 4, 8, 12 then

 

usa "array" ou "or"

 

 

and isInArray({4,8,12}, getPlayerVocation(cid)) then

Link para o comentário
Compartilhar em outros sites

Visitante
Este tópico está impedido de receber novos posts.
×
×
  • Criar Novo...