Assim vai funcionar:
local config = {
showGamemasters = getBooleanFromString(getConfigValue('displayGamemastersWithOnlineCommand'))
}
function onSay(cid, words, param, channel)
local players = getPlayersOnline()
local strings = {""}
local i, position = 1, 1
local added = false
local vocations = {
[0] = "None",
[1] = "S",
[2] = "D",
[3] = "P",
[4] = "K",
[5] = "MS",
[6] = "ED",
[7] = "RP",
[8] = "EK",
}
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) .. ", " .. vocations[getPlayerVocation(pid)] .. "]"
i = i + 1
added = true
else
added = false
end
end
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
--- Você tem que usar uma tabela para colocar qual vai ser o nome das vocações
--Edit: Cometi um erro






info
Grupo: Campones
Registrado: 06/01/13
Posts: 36
Reputação: +4
Char no Tibia: Shooter
Tenho esse comando aqui de online
Editado Janeiro 30 por Hamsterbob