forked from fdxx/l4d2_plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
/
l4d2_view_network.sp
42 lines (37 loc) · 1.19 KB
/
l4d2_view_network.sp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
public Plugin myinfo =
{
name = "View player network status",
author = "X@IDER, fdxx",
description = "View player network status",
version = "1.2",
url = ""
}
public void OnPluginStart()
{
RegConsoleCmd("sm_netstat", Cmd_Netstat);
RegConsoleCmd("sm_rates", Cmd_Netstat);
}
Action Cmd_Netstat(int client, int args)
{
float fLoss, fChoke;
char sRate[32], sCmdRate[32], sUpdateRate[32], sLerp[32];
float fLerp;
for (int i = 1; i <= MaxClients; i++)
{
if (IsClientInGame(i) && !IsFakeClient(i))
{
fLoss = GetClientAvgLoss(i, NetFlow_Both)*100;
fChoke = GetClientAvgChoke(i, NetFlow_Both)*100;
GetClientInfo(i, "rate", sRate, sizeof(sRate));
GetClientInfo(i, "cl_cmdrate", sCmdRate, sizeof(sCmdRate));
GetClientInfo(i, "cl_updaterate", sUpdateRate, sizeof(sUpdateRate));
GetClientInfo(i, "cl_interp", sLerp, sizeof(sLerp));
fLerp = StringToFloat(sLerp)*1000;
ReplyToCommand(client, "loss: %.1f%% | choke: %.1f%% | rate: %-6s | cmdrate: %-3s | updrate: %-3s | lerp: %.1f | %N", fLoss, fChoke, sRate, sCmdRate, sUpdateRate, fLerp, i);
}
}
return Plugin_Handled;
}