Ir para conteúdo

Featured Replies

Postado

Então  pessoal do TK, não sei se é a area certa, mas enfim ...     Tibia 8.6, TFS 0.4

 

Eu quero pedir um script assim, que ele mostre o uptime do server e quantos online com os nomes dos player online e com as vocações, caso não consiga pode ser sem as vocações, mas com o Uptime e os nomes dos player e a quantidade online, se possivel.

 

Agradeço desde já, dou REP+

 

@Edit: Uptime: 88 horas e 88 minutos, player x (level), player c (level), player b (level), player a (level), 4 player online.

Editado por pauliinho157 (veja o histórico de edições)

Resolvido por ciroc

Ir para solução
  • Respostas 5
  • Visualizações 599
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Postado
Citar

function onSay(player, words, param)
    local uptime = getWorldUpTime()

    local hours = math.floor(uptime / 3600)
    local minutes = math.floor((uptime - (3600 * hours)) / 60)
    local hasAccess = player:getGroup():getAccess()
    local players = Game.getPlayers()
    local playerCount = Game.getPlayerCount()

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, "Uptime: " .. hours .. " hours and " .. minutes .. " minutes.")
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, playerCount .. " players online.")

    local i = 0
    local msg = ""
    for k, targetPlayer in ipairs(players) do
        if hasAccess or not targetPlayer:isInGhostMode() then
            if i > 0 then
                msg = msg .. ", "
            end
            msg = msg .. targetPlayer:getName() .. " [" .. targetPlayer:getLevel() .. "]"
            i = i + 1
        end

        if i == 10 then
            if k == playerCount then
                msg = msg .. "."
            else
                msg = msg .. ","
            end
            player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
            msg = ""
            i = 0
        end
    end

    if i > 0 then
        msg = msg .. "."
        player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, msg)
    end
    return false
end
 

 

Testa ai,esse é pra tfs 1.x...

Editado por ciroc (veja o histórico de edições)

Postado
  • Solução

TFS 0.4:

Citar

local config = {
    showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}

function onSay(cid, words, param, channel)
    local players = getPlayersOnline()
    local strings = {""}
    local tmp = getWorldUpTime()
    local hours = math.ceil(tmp / 3600) - 1
    local minutes = math.ceil((tmp - (3600 * hours)) / 60)
    if(minutes == 60) then
        minutes = 0
        hours = hours + 1
    end

    local i, position = 1, 1
    local added = false
    for _, pid in ipairs(players) do
        if(added) then
            if(i > (position * 7)) then
                strings[position] = strings[position] .. ","
                position = position + 1
                strings[position] = ""
            else
                strings[position] = i == 1 and "" or strings[position] .. ", "
            end
        end

        if((config.showGamemasters or getPlayerCustomFlagValue(cid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES) or not getPlayerCustomFlagValue(pid, PLAYERCUSTOMFLAG_GAMEMASTERPRIVILEGES)) and (not isPlayerGhost(pid) or getPlayerGhostAccess(cid) >= getPlayerGhostAccess(pid))) then
            strings[position] = strings[position] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"
            i = i + 1
            added = true
        else
            added = false
        end
    end

    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Uptime: " .. hours .. " hours and " .. minutes .. " minutes.")
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) online:")
    for i, str in ipairs(strings) do
        if(str:sub(str:len()) ~= ",") then
            str = str .. "."
        end

        doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
    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