Ir para conteúdo
  • 0

Helflin

Pergunta

Tenho essa talkaction.

 

 

 

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

function onSay(cid, words, param, channel)
local players = getPlayersOnline()
local strings = {""}
local sorc,druid,paladin,knight,rook = 0,0,0,0,0

local i, position = 1, 1
local added = false
for _, pid in ipairs(players) do
-- Implementacion por Xafterin.
if isSorcerer(pid) then
sorc = sorc + 1
elseif isDruid(pid) then
druid = druid + 1
elseif isPaladin(pid) then
paladin = paladin + 1
elseif isKnight(pid) then
knight = knight + 1
end
---
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, (i - 1) .. " player(s) online on OT Server:")
for i, str in ipairs(strings) do
if(str:sub(str:len()) ~= ",") then
str = str .. ". ".. sorc .." sorcerers, ".. druid .." druids, ".. paladin .." paladins, ".. knight .." knights and ".. rook .." rookies."
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
end

return true
end

 

 

 

Eu queria que ao invés de ficar assim:

 

16:47 2 player(s) online on OT Server:
16:47 Testando Um [8], Testando Dois [8]. 0 sorcerers, 0 druids, 0 paladins, 2 knights and 0 rookies.

 

 

Ficasse assim:

 

16:47 2 player(s) online on OT Server: 0 sorcerers, 0 druids, 0 paladins, 2 knights and 0 rookies.

 

 

OU SEJA, NÃO MOSTRAR OS NOMES DOS JOGADORES PARA NÃO FICAR UMA LISTA GRANDE.

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

  • 0

Use essa:

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
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, (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
Editado por Shoguns
Link para o comentário
Compartilhar em outros sites

  • 0

Não po, a que vc me passou ficou assim:

 

17:09 2 player(s) online:
17:09 Testando [8], Testando Dois [8].

 

 

Removi as linhas e ficou perfeito:

for i, str in ipairs(strings) do
if(str:sub(str:len()) ~= ",") then
str = str .. "."
end

doPlayerSendTextMessage
(cid, MESSAGE_STATUS_CONSOLE_BLUE, str)
end

 

 

 

 

RESOLVIDO.

Editado por Helflin
Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...