Ir para conteúdo
  • 0

Script Reset BUG


JonatasLucasf

Pergunta

galera estou com esse script de reset aqui que o fireelement fez ele ta funcionando 100% o problema é que não está contando os stages exemplo o player está sempre resetando level 350

 

 

local config = {
    backToLevel = 8,
    exp = 4200,
    redskull = false,
    battle = false,
    pz = false,
    stages = {
        {resets = 4, level = 350, vip = 330},
        {resets = 9, level = 355, vip = 335},
        {resets = 14, level = 360, vip = 340},
        {resets = 19, level = 365, vip = 345},
        {resets = 24, level = 380, vip = 350},
        {resets = 29, level = 390, vip = 355},
        {resets = 34, level = 410, vip = 360},
        {resets = 39, level = 430, vip = 365},
        {resets = 44, level = 450, vip = 370}
    }
}

function onSay(cid, words, param)
    local function getResets(cid)
        local resets = getPlayerStorageValue(cid, 1020)
        return resets < 0 and 0 or resets
    end
    
    local function setResets(cid, count)
        setPlayerStorageValue(cid, 1020, getResets(cid) + count)
    end
    
    if config.redskull and getCreatureSkullType(cid) == 4 then
        return doPlayerSendCancel(cid, "Voce precisa estar sem red skull para resetar.")
    elseif config.pz and not getTilePzInfo(getCreaturePosition(cid)) then
        return doPlayerSendCancel(cid, "Voce precisa estar em protection zone para resetar.")
    elseif config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
        return doPlayerSendCancel(cid, "Voce precisa estar sem battle para resetar.")
    end
    
    local resetLevel = 0
    for x, y in ipairs(config.stages) do
        if getResets(cid) <= y.resets then
            resetLevel = isPremium(cid) and y.vip or y.level
            break
        end
    end
    
    if getPlayerLevel(cid) < resetLevel then
        return doPlayerSendCancel(cid, "Voce precisa do level " .. resetLevel .. " ou mais para resetar.")
    end
    
    setResets(cid, 1)
    local guid = getPlayerGUID(cid)
    doRemoveCreature(cid, true)
    db.query("UPDATE `players` SET `level` = " .. config.backToLevel .. ", `experience` = " .. config.exp .. " WHERE `id` = " .. guid)
    return true
end
Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

 

local config = {
    backToLevel = 8,
    exp = 4200,
    redskull = false,
    battle = false,
    pz = false,
    stages = {
    [{0, 4}] = {350,330},  -- free, vip
    [{5, 9}] = {355,335},
    [{10, 14}] = {360,340},
    [{15, 19}] = {365,345},
    [{20, 24}] = {380,350},
    [{25, 29}] = {390,355},
    [{30, 34}] = {410,360},
    [{35, 39}] = {430,365},
    [{40,math.huge}] = {450,370}
}
}
    function getResets(cid)
        return getPlayerStorageValue(cid, 1020) < 0 and 0 or getPlayerStorageValue(cid, 1020)
    end
    function setResets(cid, count)
        return setPlayerStorageValue(cid, 1020, getResets(cid) + count)
    end
function onSay(cid, words, param)
    if config.redskull and getCreatureSkullType(cid) >= 4 then
        doPlayerSendCancel(cid, "Voce precisa estar sem red skull para resetar.") return true
    elseif config.pz and not getTilePzInfo(getCreaturePosition(cid)) then
        doPlayerSendCancel(cid, "Voce precisa estar em protection zone para resetar.") return true
    elseif config.battle and getCreatureCondition(cid, CONDITION_INFIGHT) then
        doPlayerSendCancel(cid, "Voce precisa estar sem battle para resetar.") return true
    end
    for var, ret in pairs(config.stages) do
        if getResets(cid) >= var[1] and getResets(cid) <= var[2] then
           resetLevel = isPremium(cid) and ret[2] or ret[1]
           end
        end
    if getPlayerLevel(cid) < resetLevel then
        doPlayerSendCancel(cid, "Voce precisa do level " .. resetLevel .. " ou mais para resetar.") return true
    end
    setResets(cid, 1)
    local guid = getPlayerGUID(cid)
    doRemoveCreature(cid, true)
    return db.query("UPDATE `players` SET `level` = " .. config.backToLevel .. ", `experience` = " .. config.exp .. " WHERE `id` = " .. guid)
end
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...