• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Lua How Add Code Unable to use

Gaber Zen

Well-Known Member
Joined
Apr 22, 2023
Messages
225
Reaction score
52
Location
Egypt
hello Guys
It is possible every time I use it (!reset) Be with me items or scrolls like that
Until I can use it everytime in
otx-8.60
<talkaction access="0-4" words="!reset" event="script" value="reset_system_talk.lua"/>
Lua:
function onSay(cid, words, param, channel)
    if (param:lower() == "info") then
        local message = "~~~~~~~~~~Reset Infos ~~~~~~~~~~\n"
        local resetsCount = ResetSystem:getCount(cid)
        message = message .. "\nNúmero de Resets: " .. resetsCount .. "."

        local level = getPlayerLevel(cid)
        local vocationInfo = getVocationInfo(getPlayerVocation(cid))
        local baseHealth, extraHealth
        local baseMana, extraMana
        local resetBonus = ResetSystem:getCurrentBonus(cid)
        if (resetBonus and vocationInfo) then
            baseHealth = vocationInfo.healthGain * level
            extraHealth = getCreatureMaxHealth(cid) - baseHealth
            baseMana = vocationInfo.manaGain * level
            extraMana = getCreatureMaxMana(cid) - baseMana
        else
            baseHealth, extraHealth = getCreatureMaxHealth(cid), 0
            baseMana, extraMana = getCreatureMaxMana(cid), 0
        end

        message = message .. "\nVida normal: " .. baseHealth .. " + " .. extraHealth .. "."
        message = message .. "\nMana normal: " .. baseMana .. " + " .. extraMana .. "."
        message = message .. "\nExp Stage Bonús: " .. getExperienceStage(level) .. "x + " .. ((resetBonus and resetBonus.experiencePercent) or "0") .. "%."
        message = message .. "\nDamage Bonús: " .. ((resetBonus and resetBonus.damagePercent) or "0") .. "%."
        message = message .. "\nProximo Reset: Lv" .. (resetsCount < ResetSystem.max_count and ((resetsCount + 1) * ResetSystem.needed_level_per_reset) or "0") .. "."
        doShowTextDialog(cid, 8983, message)
    else
        local position = getThingPosition(cid)
        local tileInfo = getTileInfo(position)
        if (tileInfo and not tileInfo.protection) then
            doPlayerSendCancel(cid, "Você só pode usar esse comando em protection zone.")
            doSendMagicEffect(position, CONST_ME_POFF)
            return true
        end

        local resetsCount = ResetSystem:getCount(cid)
        if (resetsCount >= ResetSystem.max_count) then
            doPlayerSendCancel(cid, "Você já atingiu o nível máximo de resets.")
            doSendMagicEffect(position, CONST_ME_POFF)
            return true
        end

        local levelNeeded = (resetsCount + 1) * ResetSystem.needed_level_per_reset
        if (levelNeeded > getPlayerLevel(cid)) then
            doPlayerSendCancel(cid, "Você precisa ser level " .. levelNeeded .. " ou maior.")
            doSendMagicEffect(position, CONST_ME_POFF)
            return true
        end

        ResetSystem:execute(cid)
        doSendMagicEffect(position, CONST_ME_TELEPORT)
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
        doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    end
    return true
end
 
Lua:
function onSay(cid, words, param, channel)
    if (param:lower() == "info") then
        -- Seu código atual de exibir informações de reset
        local message = "~~~~~~~~~~Reset Infos ~~~~~~~~~~\n"
        local resetsCount = ResetSystem:getCount(cid)
        message = message .. "\nNúmero de Resets: " .. resetsCount .. "."

        local level = getPlayerLevel(cid)
        local vocationInfo = getVocationInfo(getPlayerVocation(cid))
        local baseHealth, extraHealth
        local baseMana, extraMana
        local resetBonus = ResetSystem:getCurrentBonus(cid)
        if (resetBonus and vocationInfo) then
            baseHealth = vocationInfo.healthGain * level
            extraHealth = getCreatureMaxHealth(cid) - baseHealth
            baseMana = vocationInfo.manaGain * level
            extraMana = getCreatureMaxMana(cid) - baseMana
        else
            baseHealth, extraHealth = getCreatureMaxHealth(cid), 0
            baseMana, extraMana = getCreatureMaxMana(cid), 0
        end

        message = message .. "\nVida normal: " .. baseHealth .. " + " .. extraHealth .. "."
        message = message .. "\nMana normal: " .. baseMana .. " + " .. extraMana .. "."
        message = message .. "\nExp Stage Bonús: " .. getExperienceStage(level) .. "x + " .. ((resetBonus and resetBonus.experiencePercent) or "0") .. "%."
        message = message .. "\nDamage Bonús: " .. ((resetBonus and resetBonus.damagePercent) or "0") .. "%."
        message = message .. "\nProximo Reset: Lv" .. (resetsCount < ResetSystem.max_count and ((resetsCount + 1) * ResetSystem.needed_level_per_reset) or "0") .. "."
        doShowTextDialog(cid, 8983, message)
    else
        local position = getThingPosition(cid)
        local tileInfo = getTileInfo(position)
        if (tileInfo and not tileInfo.protection) then
            doPlayerSendCancel(cid, "Você só pode usar esse comando em protection zone.")
            doSendMagicEffect(position, CONST_ME_POFF)
            return true
        end

        local resetsCount = ResetSystem:getCount(cid)
        if (resetsCount >= ResetSystem.max_count) then
            doPlayerSendCancel(cid, "Você já atingiu o nível máximo de resets.")
            doSendMagicEffect(position, CONST_ME_POFF)
            return true
        end

        local levelNeeded = (resetsCount + 1) * ResetSystem.needed_level_per_reset
        if (levelNeeded > getPlayerLevel(cid)) then
            doPlayerSendCancel(cid, "Você precisa ser level " .. levelNeeded .. " ou maior.")
            doSendMagicEffect(position, CONST_ME_POFF)
            return true
        end

        -- Coletar itens do jogador
        local itemsToRemove = {
            {itemid = 1234, count = 1}, -- Exemplo: ID do item e quantidade
            {itemid = 5678, count = 3}, -- Outro exemplo
            -- Adicione mais itens conforme necessário
        }
        for _, item in ipairs(itemsToRemove) do
            if (getPlayerItemCount(cid, item.itemid) < item.count) then
                doPlayerSendCancel(cid, "Você não tem todos os itens necessários para resetar.")
                doSendMagicEffect(position, CONST_ME_POFF)
                return true
            else
                doPlayerRemoveItem(cid, item.itemid, item.count)
            end
        end

        -- Adicione o código abaixo para dar itens ou pergaminhos ao jogador após o reset
        local itemsToGive = {
            {itemid = 1234, count = 1}, -- Exemplo: ID do item e quantidade
            {itemid = 5678, count = 3}, -- Outro exemplo
            -- Adicione mais itens conforme necessário
        }
        for _, item in ipairs(itemsToGive) do
            doPlayerAddItem(cid, item.itemid, item.count)
        end

        -- Código de reset atual
        ResetSystem:execute(cid)
        doSendMagicEffect(position, CONST_ME_TELEPORT)
        doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
        doSendMagicEffect(getThingPosition(cid), CONST_ME_TELEPORT)
    end
    return true
end
 
Last edited:
The Scrolls Give items after Reset.
I need script Take items from player if you need use it, items Remove
 
Last edited:

Similar threads

Back
Top