Jump to content

coloured ping?


SoiiNoob

Recommended Posts

can be possible?

Some like this

function colorping() 
    local ping = getPlayerPing(source) 
    if (ping < 40) then -- less than 40 ping it will be green 
        tocolor(0,255,0,255) 
    if (ping > 40) then -- more than 40 it will be red 
        tocolor(255,0,0,255) 
        end 
    end 
end 
addEventHandler("onPlayerJoin", getRootElement(), colorping) 

Debugscript: No errors found

Link to comment

I added

function Ping () 
local latencia = getPlayerPing(source) 
local color = tocolor 
if (latencia > 40) then 
color(255,255,0,255) 
end 
if (latencia < 50) then 
color(255,0,0,255) 
    end 
end 
addEventHandler("getPlayerPing",Ping,latencia) 

in the finish of dxscoreboard_client.lua but it still in white

Link to comment
Just so you know, 40+ is a little low for red. 40 is still a good ping.

True. I have every time min.120 ping :)

Maybe is better:

50 green

100 yellow

200 orange

300 red

And why u use ever if and not elseif?

Edit:

Anyway u Code is wrong and I can't give u the example now why reply with iPhone.

If nobody help u I can make this later.

Link to comment

Add line @ 706 in scoreboard:

                            elseif column.name == "ping" then 
                                local ping = tonumber ( content ) 
                                local r, g 
                                if ping < 150 then 
                                  r = 255 
                                  g = ( ping / 150 ) * 255 
                                else 
                                  r = ( ( 300 - ping ) / 150 ) * 255 
                                  g = 255 
                                end 
                                dxDrawText( content, topX+theX+s(1),    y+s(1), topX+x+s(1+column.width),   y+s(11)+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ),    tocolor( 0, 0, 0, a or 255 ), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI ) 
                                dxDrawText( content, topX+theX,         y,      topX+x+s(column.width),     y+dxGetFontHeight( fontscale(contentFont, scoreboardScale), contentFont ),          tocolor( g, r, 0, a or 255 ), fontscale(contentFont, s(1)), contentFont, "left", "top", true, false, drawOverGUI ) 

So I made it by myself toady.

  • Thanks 1
Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...