Jump to content

(Resolvido)Ao upar club ganhar recompensa


Go to solution Solved by Shiuns,

Recommended Posts

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 to post
Share on other sites

  • Solution
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 to post
Share on other 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 to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

Confirmação de Termo