Raised This Month: $51 Target: $400
 12% 

Ping difference


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Boundoks
New Member
Join Date: Jan 2024
Old 01-29-2024 , 23:41   Ping difference
Reply With Quote #1

Hello. When I use this plugin (or use the server console 'status' command) it tells me I have a ping of 26. When I press the TAB key to view the scoreboard with my ping it states my ping is 5.
Repeated usage gives me similar numbers.
Why the difference?

#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>

public Plugin myinfo = {
name = "Ping_Viewer",
author = "alasfourom, modified by PC Gamer",
description = "Print Your Ping Into Chat",
version = "1.1",
url = "https://forums.alliedmods.net/"
};

public void OnPluginStart() {
RegConsoleCmd("sm_ping", Command_Ping, "Print Ping To Chat");
RegAdminCmd("sm_pingall", Command_PingAll, ADMFLAG_SLAY, "Print all Human Ping values to chat");
}

public Action Command_Ping(int client, int args)
{
if (IsClientInGame(client) && !IsFakeClient(client))
{
char sBuffer[64];
FormatEx(sBuffer, sizeof(sBuffer), "\x04Your Current Ping:\x05 %.3f ms", GetClientAvgLatency(client, NetFlow_Both));
ReplaceString(sBuffer, sizeof(sBuffer), "0.00", "", false);
ReplaceString(sBuffer, sizeof(sBuffer), "0.0", "", false);
ReplaceString(sBuffer, sizeof(sBuffer), "0.", "", false);
PrintToChat(client, sBuffer);
}
return Plugin_Handled;
}

public Action Command_PingAll(int client, int args)
{
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && !IsFakeClient(i))
{
char sBuffer[64];
FormatEx(sBuffer, sizeof(sBuffer), "\x04Current Ping:\x05 %.3f ms", GetClientAvgLatency(i, NetFlow_Both));
ReplaceString(sBuffer, sizeof(sBuffer), "0.00", "", false);
ReplaceString(sBuffer, sizeof(sBuffer), "0.0", "", false);
ReplaceString(sBuffer, sizeof(sBuffer), "0.", "", false);
PrintToChat(client, "%N: %s", i, sBuffer);
}
}
return Plugin_Handled;
}
Boundoks is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-30-2024 , 03:57   Re: Ping difference
Reply With Quote #2

Scoreboard ping
https://github.com/ValveSoftware/sou.../util.cpp#L749
...it calculate with ticks and player cl_cmdrate value.
Kindy look like a mess.


...can't show "status" or "ping" command, I'm using mobile phone.
__________________
Do not Private Message @me
Bacardi 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 13:48.


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