Ir para conteúdo

Posts Recomendados

Postado

Tente esse script:

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.")

    local i = 0
    local msg = ""
    for k, tmpPlayer in ipairs(players) do
        local function getPlayerResets()
            local resets = tmpPlayer:getStorageValue(500)
            return resets < 0 and 0 or resets
        end

        if hasAccess or not tmpPlayer:isInGhostMode() then
            if i > 0 then
                msg = msg .. ", "
            end
            msg = msg .. tmpPlayer:getName() .. " (" .. tmpPlayer:getLevel() .. ") [" .. getPlayerResets() .. "]"
            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
  • Respostas 8
  • Created
  • Última resposta

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Postado (editado)

NAO DEU

POREM O ERRO E OUTRO AGORA!

 

 

Tente esse script:

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.")

    local i = 0
    local msg = ""
    for k, tmpPlayer in ipairs(players) do
        local function getPlayerResets()
            local resets = tmpPlayer:getStorageValue(500)
            return resets < 0 and 0 or resets
        end

        if hasAccess or not tmpPlayer:isInGhostMode() then
            if i > 0 then
                msg = msg .. ", "
            end
            msg = msg .. tmpPlayer:getName() .. " (" .. tmpPlayer:getLevel() .. ") [" .. getPlayerResets() .. "]"
            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
Editado por Dennyz (veja o histórico de edições)
Postado

Sim, mas qual é o erro? 

[Error - Talkaction Interface]
data/talkactions/scripts/online.lua:onSay
description:
data/talkactions/scripts/online.lua:2: attempt to call global 'Player' <anil value>
stack traceback
data/talkactions/script/online.lua:2: in function <data/talkactions/script/online.lua:1

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

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emojis são permitidos.

×   Seu link foi automaticamente incorporado.   Mostrar como link

×   Seu conteúdo anterior foi restaurado.   Limpar o editor

×   Não é possível colar imagens diretamente. Carregar ou inserir imagens do URL.

  • Quem Está Navegando   0 membros estão online

    • Nenhum usuário registrado visualizando esta página.
  • Estatísticas dos Fóruns

    96.9k
    Tópicos
    519.6k
    Posts



×
×
  • Criar Novo...

Informação Importante

Confirmação de Termo