LE
pedido

(Talkaction)!online Diferente

Por LeoXder, 08 de set. de 2012 em Scripts

online
12
1.7k
LeoXderL
08 de setembro de 2012 às 00:00

presiso de um comando que somente monstre o numero de players online no !online sem aparecer os nomes deles

 

Quem me ajudar Dou REP+

VodkartV
08 de setembro de 2012 às 09:03
function onSay(cid, words, param, channel)
       local showGamemasters,on,count = false,getPlayersOnline(),0
       for _, cid in pairs(on) do
               if getPlayerAccess(cid) < 3 then
                       count = count + 1
               end
       end
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,(showGamemasters == true and #on or count).." player(s) online.")
end

15790911
08 de setembro de 2012 às 09:10

Na pasta talkactions do seu ot, crie um arquivo lua chamado online, e coloque isso dentro:

 

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,22, (i - 1) .. " jogador(s) online no servidor!")

for i, str in ipairs(strings) do

if(str:sub(str:len()) ~= ",") then

str = str .. "."

end

end

return TRUE

end

 

a tag que vai no xml é essa:

 

<talkaction words="!online" event="script" value="online.lua"/>

 

Caso eu tenha ajudado, +REP :))

Editado Setembro 8 por GuizitoG

LeoXderL
08 de setembro de 2012 às 16:42

GuizitoG o seu script n funcionou :(

 

Vodkart eu keria que tb aparecece na tela do jogador em verde a msm coisa que aparece no default

15790911
08 de setembro de 2012 às 16:47

LooL, como assim n funfou?? oq eu fiz apareçe em granco na tela do jogador... normalmente. Aki funciona perfeitamente

LeoXderL
08 de setembro de 2012 às 16:49

Eu presiso pra um server 8.4 , e aki o seu não funcionou :S

15790911
08 de setembro de 2012 às 16:52

da algum erro no distro e talz??

LeoXderL
08 de setembro de 2012 às 16:54

[08/09/2012 16:53:58] Lua Script Error: [TalkAction Interface]

[08/09/2012 16:53:58] data/talkactions/scripts/online.lua:onSay

 

[08/09/2012 16:53:58] data/talkactions/scripts/online.lua:19: attempt to call global 'getPlayerGhostAccess' (a nil value)

[08/09/2012 16:53:58] stack traceback:

[08/09/2012 16:53:58] data/talkactions/scripts/online.lua:19: in function <data/talkactions/scripts/online.lua:4>

VodkartV
08 de setembro de 2012 às 16:55
function onSay(cid, words, param, channel)
       local showGamemasters,on,count = false,getPlayersOnline(),0
       for _, cid in pairs(on) do
               if getPlayerAccess(cid) < 3 then
                       count = count + 1
               end
       end
return doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,(showGamemasters == true and #on or count).." player(s) online.")
end

notle2012N
08 de setembro de 2012 às 16:56

GuizitoG o seu script n funcionou :(

 

Vodkart eu keria que tb aparecece na tela do jogador em verde a msm coisa que aparece no default

 

 

function onSay(cid, words, param, channel)
	local showGamemasters,on,count = false,getPlayersOnline(),0
	for _, cid in pairs(on) do
			if getPlayerAccess(cid) < 3 then
					count = count + 1
			end
	end
	doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR,(showGamemasters == true and #on or count).." player(s) online.")
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE,(showGamemasters == true and #on or count).." player(s) online.")
end

 

Dúvida Sanada

 

edit

 

Vodkart ta on o.O nem mostra aqui em baixo kkk

Editado Setembro 8 por notle2012

LeoXderL
08 de setembro de 2012 às 16:57

Vlw Vodkart o seu funcionou perfeitamente REP+

VodkartV
08 de setembro de 2012 às 16:59

Vodkart ta on o.O nem mostra aqui em baixo kkk

 

Não é atoa que sou Onipresente e Onipotente UAHAUHAUAHAUAUAUAUA