SoiiNoob Posted September 19, 2012 Posted September 19, 2012 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
Castillo Posted September 19, 2012 Posted September 19, 2012 You want to set the player nametag color according to ping?
SoiiNoob Posted September 19, 2012 Author Posted September 19, 2012 some like this if you know what i mean
Castillo Posted September 19, 2012 Posted September 19, 2012 You have to edit the scoreboard resource then.
SoiiNoob Posted September 19, 2012 Author Posted September 19, 2012 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
robhol Posted September 19, 2012 Posted September 19, 2012 Just so you know, 40+ is a little low for red. 40 is still a good ping.
HunT Posted September 19, 2012 Posted September 19, 2012 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.
Cadu12 Posted September 19, 2012 Posted September 19, 2012 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. 1
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now