Raised This Month: $32 Target: $400
 8% 

Solved Formula to get a players scoreboard ping.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-10-2018 , 07:22   Formula to get a players scoreboard ping.
Reply With Quote #1

Hi. I need a forumula that retrives the exact player ping that would show on the scoreboard. This is for silently changing a ping maskers ping on the scoreboard.

There was supposley a stock for this from the smlib project (Client_GetFakePing), although that stock doesn't seem to work anymore.

Code:
GetEntProp(GetPlayerResourceEntity(), Prop_Send, "m_iPing", _, client);
This piece of code will retrive the scoreboard ping, however when a player is ping masking this willl report either 1 or 5ms at all times.

Therefor, I need a formula that caluclates the score-board ping, so I can set the correct m_iPing value on players that are ping-masking. Anyone who can shed some light on this?

Here's a log showing that Client_GetFakePing isn't working when someone is pingmasking.
Example.

Code:
int ResEntity = GetPlayerResourceEntity();

if (ResEntity != -1)
{
	PrintToChatAll("Scoreboard ping %d, GetFakePing: %d", GetEntProp(GetPlayerResourceEntity(), Prop_Send, "m_iPing", _, client), Client_GetFakePing(client, true));
}
cl_cmdrate -100 in console.
Result: Scoreboard ping 5, GetFakePing: 5

Last edited by Visual77; 03-10-2018 at 15:21.
Visual77 is offline
pride95
Senior Member
Join Date: Aug 2015
Old 03-10-2018 , 07:53   Re: Formula to get a players scoreboard ping.
Reply With Quote #2

PHP Code:

stock int GetLatency
(int Client)
{
    
float Ping 1000.0 GetClientLatency(ClientNetFlow_Both);    
    return 
RoundToNearest(Ping);

pride95 is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-10-2018 , 08:12   Re: Formula to get a players scoreboard ping.
Reply With Quote #3

That will only give me the player latency. Player latency != Scoreboard player ping.

See the difference when I'm not pingmasking (cl_cmdrate 100).

Code:
float latency = GetClientLatency(client, NetFlow_Outgoing); 
PrintToChatAll("Scoreboard ping %d, Player latency: %d", GetEntProp(GetPlayerResourceEntity(),Prop_Send, "m_iPing", _, client), RoundFloat(latency * 1000.0));
Result: Scoreboard ping 14, Player latency: 67 (probably in ms)

Last edited by Visual77; 03-10-2018 at 08:13.
Visual77 is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-10-2018 , 09:33   Re: Formula to get a players scoreboard ping.
Reply With Quote #4

Lol, turns out cl_cmdrate +100 doesn't work to mask ping in L4D2 anymore. cl_cmdrate +100 will not decrease scoreboard ping. And cl_cmdrate -100 results in cl_cmdrate 10.

However, setting your cl_cmdrate lower than 30 (10-20) = legitimate ping masking as cl_cmdrate 10 will report 5ms on the scoreboard at all times.
"cl_cmdrate" = "10" ( def. "30" ) min. 10.000000 max. 100.000000
archive user
- Max number of command packets sent to server per second

I seriosly think Valve has messed up badly this time, there's no point trying to solve it when they're allowed to pingmask without hacks. Bin this thread.

Last edited by Visual77; 03-10-2018 at 09:36.
Visual77 is offline
Mehis
Senior Member
Join Date: Mar 2013
Location: basement
Old 03-10-2018 , 13:36   Re: Formula to get a players scoreboard ping.
Reply With Quote #5

https://github.com/ValveSoftware/sou...ource.cpp#L109

https://github.com/ValveSoftware/sou.../util.cpp#L749
Mehis is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-10-2018 , 14:29   Re: Formula to get a players scoreboard ping.
Reply With Quote #6

That's the exact same formula that the smlib stock is using. (Client_GetFakePing)
https://raw.githubusercontent.com/bc...ib/clients.inc

The return value is 5 when a player masks their ping with cl_cmdrate 10, thus this is useless.

Last edited by Visual77; 03-10-2018 at 14:32.
Visual77 is offline
midnight9
Senior Member
Join Date: Nov 2012
Old 03-10-2018 , 14:49   Re: Formula to get a players scoreboard ping.
Reply With Quote #7

Would it not be easier to block players from setting cl_cmdrate below 30?
midnight9 is offline
Visual77
Veteran Member
Join Date: Jan 2009
Old 03-10-2018 , 15:16   Re: Formula to get a players scoreboard ping.
Reply With Quote #8

Quote:
Originally Posted by midnight9 View Post
Would it not be easier to block players from setting cl_cmdrate below 30?
Edit, you're right. I was running stock default cvars, that's why.


// 30 tick settings.
sm_cvar sv_maxrate 30000
sm_cvar sv_minrate 30000
sm_cvar sv_minupdaterate 30
sm_cvar sv_maxupdaterate 30
sm_cvar sv_mincmdrate 30
sm_cvar sv_maxcmdrate 30 (the max rate is clamped in l4d2 to cl_cmdrate 40 on the client, so setting this to 100 doesn't work on the client.
(The real value is 100.000 but the server has temporarily restricted it to 40.000

Last edited by Visual77; 03-11-2018 at 05:20.
Visual77 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 08:33.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode