Ir para conteúdo

Featured Replies

Postado

Quero uma atualização dessa SCRIPT, quero que ao resetar ganhar PREMIO

Spoiler

local config = {
    backToLevel = 8,
    redskull = false, -- need to be without redskull to reset?
    battle = true, -- need to be without battle to reset?
    pz = false, -- need to be in protect zone to reset?
    stages = {
        {resets = 1, level = 250, premium = 230}, -- Aqui eu quero que ganha item x
        {resets = 2, level = 270, premium = 250}, -- Aqui eu quero que ganha item Y
        {resets = 3, level = 300, premium = 270}, -- Aqui eu quero que ganha item z & assim vai
        {resets = 4, level = 325, premium = 300},
        {resets = 5, level = 350 premium = 325},
        {resets = 6, level = 375, premium = 350},
        {resets = 7, level = 400, premium = 375},
        {resets = 8, level = 450, premium = 425},
        {resets = 9, level = 475, premium = 450},
        {resets = 10, level = 480, premium = 470},
        {resets = 11, level = 510, premium = 500},
        {resets = 12, level = 550, premium = 540},
        {resets = 13, level = 590, premium = 580},
        {resets = 14, level = 630, premium = 620},
        {resets = 15, level = 680, premium = 670},
        {resets = 16, level = 730, premium = 720},
        {resets = 17, level = 780, premium = 770},
        {resets = 18, level = 860, premium = 840},
        {resets = 10, level = 930, premium = 910},
        {resets = 2^1024, level = 1010, premium = 990}
    }
}

function onSay(cid, words, param)
    local function getPlayerResets(cid)
        local resets = getPlayerStorageValue(cid, 500)
        return resets < 0 and 0 or resets
    end

    local function doPlayerAddResets(cid, count)
        setPlayerStorageValue(cid, 500, getPlayerResets(cid) + count)
    end

    if config.redskull and getCreatureSkullType(cid) == 4 then
        return doPlayerSendCancel(cid, "You need to be without red skull to reset.")
    elseif config.pz and not getTilePzInfo(getCreaturePosition(cid)) then
        return doPlayerSendCancel(cid, "You need to be in protection zone to reset.")
    elseif config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
        return doPlayerSendCancel(cid, "You need to be without battle to reset.")
    end

    local resetLevel = 0
    for x, y in ipairs(config.stages) do
        if getPlayerResets(cid) <= y.resets then
            resetLevel = isPremium(cid) and y.premium or y.level
            break
        end
    end

    if getPlayerLevel(cid) < resetLevel then
        return doPlayerSendCancel(cid, "You need level " .. resetLevel .. " or more to reset.")
    end

    doPlayerAddResets(cid, 1)
    local healthMax, manaMax = getCreatureMaxHealth(cid), getCreatureMaxMana(cid)
    doPlayerAddLevel(cid, -(getPlayerLevel(cid) - config.backToLevel))
    setCreatureMaxHealth(cid, healthMax)
    setCreatureMaxMana(cid, manaMax)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Now you have " .. getPlayerResets(cid) .. " " .. (getPlayerResets(cid) == 1 and "reset" or "resets") .. ".")
    return true
end

 

Resolvido por Pepeco

Ir para solução
Postado
  • Solução

@luisamanagel

Spoiler

local config = {
    backToLevel = 8,
    redskull = false, -- need to be without redskull to reset?
    battle = true, -- need to be without battle to reset?
    pz = false, -- need to be in protect zone to reset?
    stages = {
        {resets = 1, level = 250, premium = 230, reward = 2160, rcount = 100}, -- Só colocar reward e rcount nos proximos como esta aqui
        {resets = 2, level = 270, premium = 250, reward = 2160, rcount = 100},
        {resets = 3, level = 300, premium = 270, reward = 2160, rcount = 100},
        {resets = 4, level = 325, premium = 300},
        {resets = 5, level = 350 premium = 325},
        {resets = 6, level = 375, premium = 350},
        {resets = 7, level = 400, premium = 375},
        {resets = 8, level = 450, premium = 425},
        {resets = 9, level = 475, premium = 450},
        {resets = 10, level = 480, premium = 470},
        {resets = 11, level = 510, premium = 500},
        {resets = 12, level = 550, premium = 540},
        {resets = 13, level = 590, premium = 580},
        {resets = 14, level = 630, premium = 620},
        {resets = 15, level = 680, premium = 670},
        {resets = 16, level = 730, premium = 720},
        {resets = 17, level = 780, premium = 770},
        {resets = 18, level = 860, premium = 840},
        {resets = 10, level = 930, premium = 910},
        {resets = 2^1024, level = 1010, premium = 990}
    }
}
function onSay(cid, words, param)
    local function getPlayerResets(cid)
        local resets = getPlayerStorageValue(cid, 500)
        return resets < 0 and 0 or resets
    end
    local function doPlayerAddResets(cid, count)
        setPlayerStorageValue(cid, 500, getPlayerResets(cid) + count)
    end
    if config.redskull and getCreatureSkullType(cid) == 4 then
        return doPlayerSendCancel(cid, "You need to be without red skull to reset.")
    elseif config.pz and not getTilePzInfo(getCreaturePosition(cid)) then
        return doPlayerSendCancel(cid, "You need to be in protection zone to reset.")
    elseif config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
        return doPlayerSendCancel(cid, "You need to be without battle to reset.")
    end
    local resetLevel = 0
    for x, y in ipairs(config.stages) do
        if getPlayerResets(cid) <= y.resets then
            resetLevel = isPremium(cid) and y.premium or y.level
            doPlayerAddItem(cid, y.reward, y.rcount)
            break
        end
    end
    if getPlayerLevel(cid) < resetLevel then
        return doPlayerSendCancel(cid, "You need level " .. resetLevel .. " or more to reset.")
    end
    doPlayerAddResets(cid, 1)
    local healthMax, manaMax = getCreatureMaxHealth(cid), getCreatureMaxMana(cid)
    doPlayerAddLevel(cid, -(getPlayerLevel(cid) - config.backToLevel))
    setCreatureMaxHealth(cid, healthMax)
    setCreatureMaxMana(cid, manaMax)
    doSendMagicEffect(getCreaturePosition(cid), CONST_ME_FIREWORK_RED)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "Now you have " .. getPlayerResets(cid) .. " " .. (getPlayerResets(cid) == 1 and "reset" or "resets") .. ".")
    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