Ir para conteúdo

Featured Replies

Postado

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.
 

Resolvido por Shiuns

Ir para solução
Postado
  • 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

 

  • 2 weeks later...
Postado
  • Autor
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!

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