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

Can servers query how many fps a client is getting?


Post New Thread Closed Thread   
 
Thread Tools Display Modes
Author Message
canadianjeff
BANNED
Join Date: Sep 2016
Old 10-16-2021 , 03:25   Can servers query how many fps a client is getting?
#1

title

Last edited by asherkin; 03-07-2022 at 04:01. Reason: Restore to previous version.
canadianjeff is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-16-2021 , 08:43   Re: Can servers query how many fps a client is getting?
#2

https://sm.alliedmods.net/new-api/cl...ientAvgPackets

...player cmdrate at least tells, does he reach to server tickrate.
If player FPS goes lower than server tickrate -> player cmdrate follow player FPS
Bacardi is offline
canadianjeff
BANNED
Join Date: Sep 2016
Old 10-16-2021 , 10:22   Re: Can servers query how many fps a client is getting?
#3

this plugin was coded by you and uses that

Code:
char cvars[][] = {
	"sv_maxrate",
	"sv_minrate",
	"sv_maxupdaterate",
	"sv_minupdaterate",
	"sv_maxcmdrate",
	"sv_mincmdrate",
	"sv_client_cmdrate_difference",
	"net_splitpacket_maxrate",
	"sv_competitive_minspec",
	"sv_client_min_interp_ratio",
	"sv_client_max_interp_ratio"
};

public Plugin myinfo = 
{
	name = "SM Data Rate",
	author = "Bacardi",
	description = "Administration Menu",
	version = "0.2",
	url = ""
};



StringMap server_rates;

bool server_cvar_changed;

public void OnPluginStart()
{

	RegConsoleCmd("sm_dataratehelp", sm_dataratehelp, "Display SM Rates Help menu");
	RegConsoleCmd("sm_datarate", sm_datarate, "Display your current data rates in menu");
	RegConsoleCmd("sm_datarates", sm_datarates, "Display all players current data rates in your console");
	RegConsoleCmd("sm_serverdatarates", sm_serverdatarates, "Display server data rate settings in menu");


	server_rates = new StringMap();

	ConVar cvar;

	for(int x = 0; x < sizeof(cvars); x++)
	{
		cvar = FindConVar(cvars[x]);
		if(cvar == null) continue;

		cvar.AddChangeHook(ChangeHook);
		server_rates.SetValue(cvars[x], cvar.IntValue, true);
	}
}

public OnConfigsExecuted()
{
	server_cvar_changed = false;
}

public void ChangeHook(ConVar convar, const char[] oldValue, const char[] newValue)
{
	server_cvar_changed = true;
	char name[MAX_NAME_LENGTH];
	convar.GetName(name, sizeof(name));

	server_rates.SetValue(name, convar.IntValue, true);
}


public Action sm_dataratehelp(int client, int args)
{
	if(client == 0) return Plugin_Handled;

	Panel panel = CreatePanel();
	panel.SetTitle("SM Data Rate Help");

	panel.DrawItem("exit\n");
	panel.DrawItem("!datarate - Show your data rates");
	panel.DrawItem("!datarates - Show all players data rates in your console");
	panel.DrawItem("!serverdatarates - Show server data rate settings");
	panel.Send(client, panelhandler_help, 0);
	delete panel;


	return Plugin_Handled;
}

public int panelhandler_help(Menu menu, MenuAction action, int param1, int param2)
{
	if(action == MenuAction_End)
	{
		delete menu;
	}
	else if(action == MenuAction_Select)
	{
		switch(param2)
		{
			case 1:
			{
			}
			case 2:
			{
				FakeClientCommandEx(param1, "say !datarate");
			}
			case 3:
			{
				FakeClientCommandEx(param1, "say !datarates");
				PrintToChat(param1, "[SM] Players data rates printed in your console...");
			}
			case 4:
			{
				FakeClientCommandEx(param1, "say !serverdatarates");
			}
		}
	}
}


public Action sm_datarate(int client, int args)
{
	if(client == 0) return Plugin_Handled;

	char buffer[256];

	Panel panel = CreatePanel();
	panel.SetTitle("SM Data Rates - Your current rates");

	Format(buffer, sizeof(buffer), "exit \n \n");
	panel.DrawItem(buffer);
	Format(buffer, sizeof(buffer), "rate  %i", GetClientDataRate(client));
	panel.DrawText(buffer);
	Format(buffer, sizeof(buffer), " \nupdate %0.0f     in: %0.2fKB/s", GetClientAvgPackets(client, NetFlow_Outgoing), GetClientAvgData(client, NetFlow_Outgoing)/1000.0);
	panel.DrawText(buffer);
	Format(buffer, sizeof(buffer), "loss: %0.0f%%  choke: %0.0f%% ping: %0.0fms", GetClientAvgLoss(client, NetFlow_Outgoing)*100.0, GetClientAvgChoke(client, NetFlow_Outgoing)*100.0, GetClientAvgLatency(client, NetFlow_Outgoing)*1000.0);
	panel.DrawText(buffer);
	
	Format(buffer, sizeof(buffer), " \ncmd %0.0f     out: %0.2fKB/s", GetClientAvgPackets(client, NetFlow_Incoming), GetClientAvgData(client, NetFlow_Incoming)/1000.0);
	panel.DrawText(buffer);
	Format(buffer, sizeof(buffer), "loss: %0.0f%%  choke: %0.0f%% ping: %0.0fms", GetClientAvgLoss(client, NetFlow_Incoming)*100.0, GetClientAvgChoke(client, NetFlow_Incoming)*100.0, GetClientAvgLatency(client, NetFlow_Incoming)*1000.0);
	panel.DrawText(buffer);
	
	
	


	panel.Send(client, panelhandler, 0);
	delete panel;


	return Plugin_Handled;
}

public Action sm_datarates(int client, int args)
{
	if(client == 0) return Plugin_Handled;

	PrintToConsole(client, "\n\n");

	char buffer[1024];
	Format(buffer, sizeof(buffer), "%20s %10s %6s %6s %10s %10s %13s %s", "  name", "  rate", "update", "cmd", "in: KB/s", "out: KB/s", "in: ping ms", "out: ping ms");
	PrintToConsole(client, buffer);

	for(int i = 1; i <= MaxClients; i++)
	{
		if(!IsClientInGame(i) || IsFakeClient(i)) continue;

		Format(buffer, 20, "%N", i);

		Format(buffer, sizeof(buffer), "%20s %-10i %-6.0f %-6.0f %-10.2f %-10.2f %-13.0f %0.0f", buffer, GetClientDataRate(i), GetClientAvgPackets(i, NetFlow_Outgoing), GetClientAvgPackets(i, NetFlow_Incoming), GetClientAvgData(i, NetFlow_Outgoing)/1000.0, GetClientAvgData(i, NetFlow_Incoming)/1000.0, GetClientAvgLatency(i, NetFlow_Outgoing)*1000.0, GetClientAvgLatency(i, NetFlow_Incoming)*1000.0);
		PrintToConsole(client, buffer);
	}

	return Plugin_Handled;
}



public Action sm_serverdatarates(int client, int args)
{
	if(client == 0) return Plugin_Handled;

	char buffer[256];
	int value;

	for(int x = 0; x < sizeof(cvars); x++)
	{
		if(server_rates.GetValue(cvars[x], value)) Format(buffer, sizeof(buffer), "%s%s %i \n", buffer, cvars[x], value);
	}

	Format(buffer, sizeof(buffer), "\n \n \n \n \n \n \n%s", buffer);

	Panel panel = CreatePanel();
	panel.SetTitle(buffer);

	panel.DrawItem("exit");
	panel.Send(client, panelhandler, 0);

	delete panel;

	if(server_cvar_changed) PrintToChat(client, "*Server rate settings have changed, players need reconnect to server to accept new rate restricts");

	return Plugin_Handled;
}



public int panelhandler(Menu menu, MenuAction action, int param1, int param2)
{
	if(action == MenuAction_End) delete menu;
}

Last edited by canadianjeff; 10-16-2021 at 10:24.
canadianjeff is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 10-16-2021 , 10:44   Re: Can servers query how many fps a client is getting?
#4

...dam. I remember it have some 'bugs' as well.
Look those some day...
Bacardi is offline
canadianjeff
BANNED
Join Date: Sep 2016
Old 10-16-2021 , 10:58   Re: Can servers query how many fps a client is getting?
#5

30 tick

100 tick


seems to be somewhat good would be nice to use a timer and "monitor" the cmdrate if it falls to far behind the server or ahead of it place the player in spec or kick them

Last edited by canadianjeff; 10-16-2021 at 11:15.
canadianjeff is offline
canadianjeff
BANNED
Join Date: Sep 2016
Old 10-16-2021 , 17:07   Re: Can servers query how many fps a client is getting?
#6

so the cmdrate max on a 100 tick server should be 100 right?????

I saw a players cmdrate skyrocket up to 175 and the server started doing some really strange things is this considered a flood and can it be stopped???? kinda strange too when the max cmdrate is 100

as shown here

canadianjeff is offline
Closed Thread


Thread Tools
Display Modes

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 15:30.


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