Ir para conteúdo

Featured Replies

Postado

Um... Então ficaria mais ou menos assim...


local config = {
[50] = {{itemid = 0,0}, premmy = 5, storage = 35322}
[100]= {{itemid = 0,0}, premmy = 10, storage = 35333},
[150] = {{itemid = 0,0}, premmy = 15, storage = 35344}
}

function onAdvance(cid, oldLevel, newLevel)
if getPlayerStorageValue(cid, config[getPlayerLevel(cid)].storage) == -1 then
doPlayerAddItem(cid,config[getPlayerLevel(cid)].itemid,config[getPlayerLevel(cid)].quant)
doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Você recebeu "..verificaritem(cid, text).."" .. verificarpremmy(cid, text) .. " por chegar ao level "..getPlayerLevel(cid).."")
setPlayerStorageValue(cid, config[getPlayerLevel(cid)].storage,1)
return true
end
end

function verificaritem(cid, text)
if (config[getPlayerLevel(cid)].itemid >= 1) then
doPlayerAddItem(cid,config[getPlayerLevel(cid)].itemid,config[getPlayerLevel(cid)].quant)
local text = ""..config.quant.."" .. getItemNameById(config[getPlayerVocation(cid)].itemid) .. ""
return true
end
end

function verificarpremmy(cid, text)
if (config[getPlayerLevel(cid)].itemid >= 1) then
local e = " e "
end
if (config[getPlayerLevel(cid)].premmy >= 1) then
doPlayerAddPremiumDays(cid, config[getPlayerLevel(cid)].premmy)
local text = "" .. e .. "" .. config.premmy .. " dias de premmy"
return true
end
end
[/code]

ps. não testei ._.

Há tempos que não programo e posso estar equivocado, mas não teria que retornar a var local nas funções de verificar?

  • Respostas 12
  • Visualizações 858
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

  • Gustavo Ferreira
    Gustavo Ferreira

    Boa ideia @comedinhass! Thiago, compareca ao tópico queremos lhe usar HAUSDUASDHU

Postado

acho que assim funciona

function onAdvance(cid, skill, oldLevel, newLevel)

local config = {

{level = 50, itemid = {false, 2160,10}, premmy = 5, storage = 143801},

{level = 100, itemid = {true, 2160,1}, premmy = 0, storage = 143802},

{level = 150, itemid = {true, 2160,5}, premmy = 10, storage = 143803}

}

if skill ~= SKILL__LEVEL then return true end

for i = 1, #config do

if newLevel >= config[i].level and getPlayerStorageValue(cid, config[i].storage) == -1 then

doPlayerSendTextMessage(cid,MESSAGE_STATUS_CONSOLE_BLUE,"Você recebeu"..(config[i].itemid[1] == true and ", "..config[i].itemid[3].." "..getItemNameById(config[i].itemid[2]) or "")..""..(config[i].premmy > 0 and ", "..config[i].premmy.." dias de premium" or "").."  por chegar ao level "..config[i].level)

if config[i].itemid[1] == true then doPlayerAddItem(cid, config[i].itemid[2], config[i].itemid[3]) end

doPlayerAddPremiumDays(cid, config[i].premmy > 0 and config[i].premmy or 0)

setPlayerStorageValue(cid, config[i].storage, 1)

break

end

end

return true

end

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.6k

Informação Importante

Confirmação de Termo