Ir para conteúdo

Featured Replies

Postado

oi boa noite, encontrei esse script no fórum, alguém consegue editar para ele adicionar magic level, também? Ele gasta os pontos mas não aumenta o ml

 

lib

-- #######################################
-- ####### Developed by MaXwEllDeN #######
-- ####### Level Points System     #######
-- ####### Version: 1.0            #######
-- #######################################

L_LvlPoints = {
    vocPoints = {
        -- [Skill] = Pontos que ganha,
        [1] = 2,
        [2] = 2,
        [3] = 2,
        [4] = 2,
    },

    attributes = {
        ["vitalidade"] = {np = 2, vl = 20, nm = "Hit Points"}, -- Precisa usar 2 points para adicionar 10 de hp
        ["energy"] = {np = 4, vl = 10, nm = "Mana Points"},
        ["magic"] = {np = 10, vl = 2, nm = "Magic Level"},
        ["shielding"] = {np = 5, vl = 1, nm = "Shielding Skill"},
        ["sword"] = {np = 2, vl = 1, nm = "Sword Skill"},
        ["axe"] = {np = 2, vl = 1, nm = "Axe Skill"},
        ["club"] = {np = 2, vl = 1, nm = "Club Skill"},
        ["distance"] = {np = 2, vl = 1, nm = "Distance Skill"},
    }

}

 

Talkactions

Você tem o código disponível? Se tiver publique-o aqui: 

-- #######################################
-- ####### Developed by MaXwEllDeN #######
-- ####### Level Points System     #######
-- ####### Version: 1.0            #######
-- #######################################

function onSay(cid, words, param)
    if not (L_LvlPoints.vocPoints[getPlayerVocation(cid)]) then
        return false
    end

    local param = param:lower()
    local p2 = string.explode(param, ",")

    if (getPlayerStorageValue(cid, 14574) < 0) then
        setPlayerStorageValue(cid, 14574, 0)
    end

    local skillids = {
        ["shielding"] = 5,
        ["sword"] = 2,
        ["axe"] = 3,
        ["club"] = 1,
        ["distance"] = 4,
    }

    if (param == "check") then
        doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574) .."\nPontos por level: ".. L_LvlPoints.vocPoints[getPlayerVocation(cid)])
    elseif (p2[1] and p2[1] == "add") and (L_LvlPoints.attributes[p2[2]]) and (tonumber(p2[3])) then
        if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np) then
            doPlayerSendCancel(cid, "Você não tem pontos suficientes para distribuir!")
            return doSendMagicEffect(getThingPos(cid), 2)
        end

        if (p2[2] == "vitalidade") then
            setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
            doCreatureAddHealth(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
        elseif (p2[2] == "energy") then
            setCreatureMaxMana(cid, getCreatureMaxMana(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
            doCreatureAddMana(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
         elseif(skillids[p2[2]]) then
            for a = 1, tonumber(p2[3]) do
                doPlayerAddSkillTry(cid, skillids[p2[2]], getPlayerRequiredSkillTries(cid, skillids[p2[2]], getPlayerSkillLevel(cid, skillids[p2[2]]) + 1) - getPlayerSkillTries(cid, skillids[p2[2]]), false)
            end
        end

        doSendMagicEffect(getThingPos(cid), 29)
        doSendMagicEffect(getThingPos(cid), 30)
        doSendAnimatedText(getThingPos(cid), "-" .. tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np, 180)
        setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np)
    else
        local msgx = ""
        for i, v in pairs(L_LvlPoints.attributes) do
            local add = (v.np > 1) and "s" or ""
            msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " ponto".. add .. " ~ " .. v.vl .. " ".. v.nm .. "\n"
        end

        doPlayerPopupFYI(cid, "Pontos necessários para aumentar os stats:\n\n".. msgx .. "\nExemplo de uso: ".. words .." add, vitalidade, 5\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574))
    end

    return true
end

 

 

 

Resolvido por matheuspeixoto12

Ir para solução
Postado
- #######################################
-- ####### Developed by MaXwEllDeN #######
-- ####### Level Points System     #######
-- ####### Version: 1.0            #######
-- #######################################

local function addMagLevel(cid, amount)
    local amount = amount or 1
    for i = 1, amount do
        doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid), false)
    end
    return true
end

function onSay(cid, words, param)
    if not (L_LvlPoints.vocPoints[getPlayerVocation(cid)]) then
        return false
    end
    local param = param:lower()
    local p2 = string.explode(param, ",")
    if (getPlayerStorageValue(cid, 14574) < 0) then
        setPlayerStorageValue(cid, 14574, 0)
    end

    local skillids = {
        ["shielding"] = 5,
        ["sword"] = 2,
        ["axe"] = 3,
        ["club"] = 1,
        ["distance"] = 4,
    }

    if (param == "check") then
        doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574) .."\nPontos por level: ".. L_LvlPoints.vocPoints[getPlayerVocation(cid)])
    elseif (p2[1] and p2[1] == "add") and (L_LvlPoints.attributes[p2[2]]) and (tonumber(p2[3])) then
        if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np) then
            doPlayerSendCancel(cid, "Você não tem pontos suficientes para distribuir!")
            return doSendMagicEffect(getThingPos(cid), 2)
        end
        if (p2[2] == "vitalidade") then
            setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
            doCreatureAddHealth(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
        elseif (p2[2] == "energy") then
            setCreatureMaxMana(cid, getCreatureMaxMana(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
            doCreatureAddMana(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
        elseif (p2[2] == "magic" then)
            addMagLevel(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
         elseif(skillids[p2[2]]) then
            for a = 1, tonumber(p2[3]) do
                doPlayerAddSkillTry(cid, skillids[p2[2]], getPlayerRequiredSkillTries(cid, skillids[p2[2]], getPlayerSkillLevel(cid, skillids[p2[2]]) + 1) - getPlayerSkillTries(cid, skillids[p2[2]]), false)
            end
        end

        doSendMagicEffect(getThingPos(cid), 29)
        doSendMagicEffect(getThingPos(cid), 30)
        doSendAnimatedText(getThingPos(cid), "-" .. tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np, 180)
        setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np)
    else
        local msgx = ""
        for i, v in pairs(L_LvlPoints.attributes) do
            local add = (v.np > 1) and "s" or ""
            msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " ponto".. add .. " ~ " .. v.vl .. " ".. v.nm .. "\n"
        end

        doPlayerPopupFYI(cid, "Pontos necessários para aumentar os stats:\n\n".. msgx .. "\nExemplo de uso: ".. words .." add, vitalidade, 5\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574))
    end

    return true
end

 

Postado
  • Autor

apareceu esse erro

[Error - LuaScriptInterface::loadFile] data/talkactions/scripts/PointsSystem.lua:1: unexpected symbol near '-'
[Warning - Event::loadScript] Cannot load script (data/talkactions/scripts/PointsSystem.lua)
data/talkactions/scripts/PointsSystem.lua:1: unexpected symbol near '-'

Postado
  • Autor
  • Solução
  Em 24/08/2020 em 00:24, Belmont disse:

@matheuspeixoto12 Coloca um " " na linha 1 ficando assim

 

Deu certo, havia mais um erro também, tinha um ) colocado errado. Consegui arrumar. Está 100% 

 

Obrigado. Vou deixar o corrigido certo aqui em baixo.

 

-- #######################################
-- ####### Developed by MaXwEllDeN #######
-- ####### Level Points System     #######
-- ####### Version: 1.0            #######
-- #######################################

local function addMagLevel(cid, amount)
    local amount = amount or 1
    for i = 1, amount do
        doPlayerAddSpentMana(cid, getPlayerRequiredMana(cid, getPlayerMagLevel(cid, true) + 1) - getPlayerSpentMana(cid), false)
    end
    return true
end

function onSay(cid, words, param)
    if not (L_LvlPoints.vocPoints[getPlayerVocation(cid)]) then
        return false
    end
    local param = param:lower()
    local p2 = string.explode(param, ",")
    if (getPlayerStorageValue(cid, 14574) < 0) then
        setPlayerStorageValue(cid, 14574, 0)
    end

    local skillids = {
        ["shielding"] = 5,
        ["sword"] = 2,
        ["axe"] = 3,
        ["club"] = 1,
        ["distance"] = 4,
    }

    if (param == "check") then
        doPlayerPopupFYI(cid, "~*~*~ Level Points System by MaXwEllDeN ~*~*~\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574) .."\nPontos por level: ".. L_LvlPoints.vocPoints[getPlayerVocation(cid)])
    elseif (p2[1] and p2[1] == "add") and (L_LvlPoints.attributes[p2[2]]) and (tonumber(p2[3])) then
        if (getPlayerStorageValue(cid, 14574) < tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np) then
            doPlayerSendCancel(cid, "Você não tem pontos suficientes para distribuir!")
            return doSendMagicEffect(getThingPos(cid), 2)
        end
        if (p2[2] == "vitalidade") then
            setCreatureMaxHealth(cid, getCreatureMaxHealth(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
            doCreatureAddHealth(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
        elseif (p2[2] == "energy") then
            setCreatureMaxMana(cid, getCreatureMaxMana(cid) + L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
            doCreatureAddMana(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
        elseif (p2[2] == "magic") then
            addMagLevel(cid, L_LvlPoints.attributes[p2[2]].vl * tonumber(p2[3]))
         elseif(skillids[p2[2]]) then
            for a = 1, tonumber(p2[3]) do
                doPlayerAddSkillTry(cid, skillids[p2[2]], getPlayerRequiredSkillTries(cid, skillids[p2[2]], getPlayerSkillLevel(cid, skillids[p2[2]]) + 1) - getPlayerSkillTries(cid, skillids[p2[2]]), false)
            end
        end

        doSendMagicEffect(getThingPos(cid), 29)
        doSendMagicEffect(getThingPos(cid), 30)
        doSendAnimatedText(getThingPos(cid), "-" .. tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np, 180)
        setPlayerStorageValue(cid, 14574, getPlayerStorageValue(cid, 14574) - tonumber(p2[3]) * L_LvlPoints.attributes[p2[2]].np)
    else
        local msgx = ""
        for i, v in pairs(L_LvlPoints.attributes) do
            local add = (v.np > 1) and "s" or ""
            msgx = msgx .. string.upper(i:sub(1,1)) .. i:sub(2, #i) .. " - ".. v.np .. " ponto".. add .. " ~ " .. v.vl .. " ".. v.nm .. "\n"
        end

        doPlayerPopupFYI(cid, "Pontos necessários para aumentar os stats:\n\n".. msgx .. "\nExemplo de uso: ".. words .." add, vitalidade, 5\n\nPontos disponíveis: ".. getPlayerStorageValue(cid, 14574))
    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