Ir para conteúdo
  • 0

Comando !online


Nando3513

Pergunta

eu queria o script !online , mais ao invez de aparecer o nome dos char e o level so apareça a quantidade de players online.

 

ex: Há 300 players online.

 

esse aqui e o script original com os level

 

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
		strings[position] = ""
	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] .. getCreatureName(pid) .. " [" .. getPlayerLevel(pid) .. "]"			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 por Alcionir123
Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 0

111hi.jpg

ficaria assim:

 

 

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, "Há ".. (i - 1) .." Player(s) Online")
return TRUE
end

Link para o comentário
Compartilhar em outros sites

  • 0

aqui nao funcionou deu o seguinte erro no console

 

[22/08/2010 17:23:20] data/talkactions/scripts/online.lua:22: attempt to call global 'getPlayerGhostAccess' (a nil value)
[22/08/2010 17:23:20] stack traceback:
[22/08/2010 17:23:20] 	data/talkactions/scripts/online.lua:22: in function <data/talkactions/scripts/online.lua:5>

Link para o comentário
Compartilhar em outros sites

  • 0

hm seu servidor nao tem a funçao rs

 

usa 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 == 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
		added = true
	else
		added = false
	end
end

doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Há ".. (i - 1) .." Player(s) Online")

return TRUE
end

Link para o comentário
Compartilhar em outros sites

×
×
  • Criar Novo...