Ir para conteúdo
  • Cadastre-se

(Resolvido)Ao upar club ganhar recompensa


Ir para solução Resolvido por Shiuns,

Posts Recomendados

Qual o motivo deste tópico? 

Preciso de uma ajuda, peguei uma script de recompensa por levele gostaria de fazer algumas mudanças nessa script, porem estou quebrando a cabeça para tentar resolver pois sou novato e não entendo 100% de script.

 

Script da recompensa original: 

function onAdvance(cid, skill, oldLevel, newLevel)

local config = {
[50] = {item = 2160, count = 5},
[100] = {item = 2160, count = 15},
[150] = {item = 2160, count = 20},
[200] = {item = 2160, count = 25},
[250] = {item = 2160, count = 30},
[300] = {item = 2160, count = 50},
[350] = {item = 4891, count = 1},
[400] = {item = 4892, count = 1},
}

if skill == 8 then
for level, info in pairs(config) do
if newLevel >= level and (getPlayerStorageValue(cid, 30700) == -1 or not (string.find(getPlayerStorageValue(cid, 30700), "'" .. level .. "'"))) then
doPlayerAddItem(cid, info.item, info.count)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Parabéns, você atingiu o level "..newLevel.." e ganhou "..info.count.." "..getItemNameById(info.item)..".")
local sat = getPlayerStorageValue(cid, 30700) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30700) .. ",'" .. level .. "'" 
setPlayerStorageValue(cid, 30700, sat)
end
end
end

return TRUE
end

 

 

Aqui está o que eu "tentei" alterar:

Citar

function onAdvance(cid, skill, oldClub, newClub)

local config = {
[12] = {item = 2160, count = 5},
[13] = {item = 2160, count = 15},
[14] = {item = 2160, count = 20},
[15] = {item = 2160, count = 25},
[16] = {item = 2160, count = 30},
[17] = {item = 2160, count = 50},
[350] = {item = 4891, count = 1},
[608] = {item = 11499, count = 1},
}

if skill == 8 then
for club, info in pairs(config) do
if newClub >= club and (getPlayerStorageValue(cid, 30700) == -1 or not (string.find(getPlayerStorageValue(cid, 30700), "'" .. level .. "'"))) then
doPlayerAddItem(cid, info.item, info.count)
doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Parabéns, você atingiu o level "..newClub.." e ganhou "..info.count.." "..getItemNameById(info.item)..".")
local sat = getPlayerStorageValue(cid, 30700) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30700) .. ",'" .. level .. "'" 
setPlayerStorageValue(cid, 30700, sat)
end
end
end

return TRUE
end

Resumo:
Preciso que ao upar a skill Club você possa ganhar uma recompensa.

Darei +REP para quem ajudar!!
(creditos:Absolute) Pela script de recompensa por level.
 

Link para o post
Compartilhar em outros sites
  • Solução
function onAdvance(cid, skill, oldLevel, newLevel)

   local config = {
      [50] = {item = 2160, count = 5},
      [100] = {item = 2160, count = 15},
      [150] = {item = 2160, count = 20},
      [200] = {item = 2160, count = 25},
      [250] = {item = 2160, count = 30},
      [300] = {item = 2160, count = 50},
      [350] = {item = 4891, count = 1},
      [400] = {item = 4892, count = 1},
   }

   if skill == SKILL_CLUB then
      for level, info in pairs(config) do
         if newLevel >= level and (getPlayerStorageValue(cid, 30705) == -1 or not (string.find(getPlayerStorageValue(cid, 30705), "'" .. level .. "'"))) then
            doPlayerAddItem(cid, info.item, info.count)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Parabéns, você atingiu o level "..newLevel.." e ganhou "..info.count.." "..getItemNameById(info.item)..".")
            local sat = getPlayerStorageValue(cid, 30705) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30705) .. ",'" .. level .. "'"
            setPlayerStorageValue(cid, 30705, sat)
         end
      end
   end
   return true
end

 

Link para o post
Compartilhar em outros sites
  • 2 weeks later...
Em 11/11/2020 em 10:47, Shiuns disse:

function onAdvance(cid, skill, oldLevel, newLevel)

   local config = {
      [50] = {item = 2160, count = 5},
      [100] = {item = 2160, count = 15},
      [150] = {item = 2160, count = 20},
      [200] = {item = 2160, count = 25},
      [250] = {item = 2160, count = 30},
      [300] = {item = 2160, count = 50},
      [350] = {item = 4891, count = 1},
      [400] = {item = 4892, count = 1},
   }

   if skill == SKILL_CLUB then
      for level, info in pairs(config) do
         if newLevel >= level and (getPlayerStorageValue(cid, 30705) == -1 or not (string.find(getPlayerStorageValue(cid, 30705), "'" .. level .. "'"))) then
            doPlayerAddItem(cid, info.item, info.count)
            doPlayerSendTextMessage(cid, MESSAGE_STATUS_WARNING, "Parabéns, você atingiu o level "..newLevel.." e ganhou "..info.count.." "..getItemNameById(info.item)..".")
            local sat = getPlayerStorageValue(cid, 30705) == -1 and "Values: '" .. level .. "'" or getPlayerStorageValue(cid, 30705) .. ",'" .. level .. "'"
            setPlayerStorageValue(cid, 30705, sat)
         end
      end
   end
   return true
end

 

Desculpa pela demora, estava sem computador!
Mas resolveu a minha dúvida!

Obrigado!

Link para o post
Compartilhar em outros sites

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo