Ir para conteúdo

Featured Replies

Postado

Oi pessoal, eu tenho um meu ot server tfs1.2 o comando !online, porem ele mostra todos os players que estão online... eu gostaria que mostrasse somente o total de players online, ao inves de mostrar 1 por 1

Agradeço desde já,

aqui embaixo esta o script que uso

Spoiler

function onSay(cid, words, param)
    local player = Player(cid)
    local hasAccess = player:getGroup():getAccess()
    local players = Game.getPlayers()
    local playerCount = Game.getPlayerCount()

    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, playerCount .. " players online.")
    setPlayerStorageValue(cid, 27099, 0)
    
    local i = 0
    local msg = ""
    for k, tmpPlayer in ipairs(players) do
        if hasAccess or not tmpPlayer:isInGhostMode() then
            if i > 0 then
                msg = msg .. ", "
            end
            msg = msg .. tmpPlayer:getName() .. " [" .. tmpPlayer: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
 

 

Resolvido por xWhiteWolf

Ir para solução
  • Respostas 14
  • Visualizações 1.6k
  • Created
  • Última resposta

Top Posters In This Topic

Most Popular Posts

Postado
  • Solução
Spoiler

function onSay(cid, words, param)
    local player = Player(cid)
    local playerCount = Game.getPlayerCount()
    player:sendTextMessage(MESSAGE_STATUS_CONSOLE_BLUE, playerCount .. " players online.")
    return false
end

 

Postado

sim, pra TFS 0.4 ficaria assim:

 

Spoiler

function onSay(cid, words, param)    
    local playerCount = #getPlayersOnline()
    doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, playerCount .. " players online.")
    return false
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.

Conteúdo Similar

Estatísticas dos Fóruns

  • Tópicos 96.9k
  • Posts 519.6k

Informação Importante

Confirmação de Termo