K2

[Encerrado] Como Mudo O Jeito !online

Por k2lan, 01 de out. de 2011 em Tópicos Sem Resposta

9
1.3k
k2lanK
01 de outubro de 2011 às 19:31

quando vc coloca no ot !online mosta

19:29 1 player(s) online:

19:29 [GOD] Kaylos [100000].

como faço apenas para mostrar a quantidade de player, sem mostrar o nick e level, apenas assim

 

19:29 100 player(s) online

.

igorbrunomaxI
01 de outubro de 2011 às 19:57

Estou com a mesma Dúvida.

Tomara que algum scripter venah aqui pra ajudar.

MulizeuM
01 de outubro de 2011 às 20:10

Veja se e isso que vc quer.

 

 

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

function onSay(cid, words, param)
local players = getPlayersOnline()
local strings = {}

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

	if((config.showGamemasters == TRUE or getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == TRUE or getPlayerCustomFlagValue(pid, PlayerCustomFlag_GamemasterPrivileges) ~= TRUE) and (isPlayerGhost(pid) ~= TRUE or getPlayerAccess(cid) > getPlayerAccess(pid))) then
		strings[position] = strings[position] ..'' 
		i = i + 1
	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 Outubro 1 por mulizeu

k2lanK
01 de outubro de 2011 às 20:29

isso mesmo, mas dei uma adaptação nele, pois o que vc postou mostra 2 linhas.

ta ai pra quem quizer usar

 

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

function onSay(cid, words, param)
   	local players = getPlayersOnline()
   	local strings = {}

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

           	else
                   	strings[position] = i == 1 and "" or strings[position] .. ""
           	end

           	if((config.showGamemasters == TRUE or getPlayerCustomFlagValue(cid, PlayerCustomFlag_GamemasterPrivileges) == TRUE or getPlayerCustomFlagValue(pid, PlayerCustomFlag_GamemasterPrivileges) ~= TRUE) and (isPlayerGhost(pid) ~= TRUE or getPlayerAccess(cid) > getPlayerAccess(pid))) then
                   	strings[position] = strings[position] ..'' 
                   	i = i + 1
           	end
   	end

   	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, (i - 1) .. " player(s) online no Moekanos Baiak 3.0")
   	for i, str in ipairs(strings) do
           	if(str:sub(str:len()) ~= "") then

           	end


   	end

   	return TRUE
end

147963lol1
03 de outubro de 2011 às 12:50

Em qual dos arquivos modifico para este para o !Online funcionar com esta adptação?

2 semanas depois...
hellcoreotH
12 de outubro de 2011 às 14:10

Em talkaction/script/online.lua

thefogT
12 de outubro de 2011 às 17:55

eu peguei o meu !online que mostra os players e os levels e fiz uma alteração, ve esse funciona

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]

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

 

aqui eu testei e funcionou, testado no The forgotten server 0.4_svn

Editado Outubro 12 por TheFog

147963lol1
14 de outubro de 2011 às 01:05

Obrigado; Vou testar isso em meu servidor assim que conseguir ligar ele novamente *-*

6 anos depois...
StigalS
20 de abril de 2018 às 00:03
A questão neste tópico de suporte foi encerrada por falta de respostas. Este tópico está fechado e foi movido para Suporte - Tópicos Sem Resposta.

+ Caso a dúvida não tenha sido resolvida você poderá criar outro tópico solicitando ajuda.
* Lembre-se que é permitido dar UP no tópico a cada 24 horas para assim o destacar e manter movimentado.