Features:
This plugin enables you to see the ping of you and every other player.
Requirements:
@Nukem's dedicated server addon 1.190+
Changelog:
v1.2 Added linux support, now needs 1.190+
v1.1 made it easier to use !ping <name>. You can now do !ping <Part of name>. For Pozzuh you can do !ping p, but !ping zuh will also work.
v1 initial release
Usage:
Screenshots:
Credits:
@Pozzuh - Made the plugin
@Nukem - Helped me with random derp & made the server addon
Source:
This plugin enables you to see the ping of you and every other player.
Requirements:
@Nukem's dedicated server addon 1.190+
Changelog:
v1.2 Added linux support, now needs 1.190+
v1.1 made it easier to use !ping <name>. You can now do !ping <Part of name>. For Pozzuh you can do !ping p, but !ping zuh will also work.
v1 initial release
Usage:
Code:
!ping // Shows your ping
!ping <name> // shows the ping of another player
!highestping // shows player with highest ping
!lowestping // shows player with lowest ping
Screenshots:
Credits:
@Pozzuh - Made the plugin
@Nukem - Helped me with random derp & made the server addon
Source:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
using Addon;
namespace myCSplugin
{
public class main : CPlugin
{
public override void OnServerLoad()
{
ServerPrint("Ping plugin loaded. Author: Pozzuh. Version: 1.1");
}
public override ChatType OnSay(string Message, ServerClient Client)
{
string lowMsg = Message.ToLower();
if (lowMsg.StartsWith("!ping"))
{
string[] splitMsg = lowMsg.Split(' ');
if (splitMsg.Length == 1)
TellClient(Client.ClientNum, "^2Ping plugin:^7 Your current ping is: " + Client.Ping, true);
else
{
ServerClient c = GetClientByName(splitMsg[1]);
if(c != null)
TellClient(Client.ClientNum, "^2Ping plugin:^7 " + c.Name + "'s ping is: " + c.Ping, true);
else
TellClient(Client.ClientNum, "^2Ping plugin: ^1Unknown player name!", true);
}
return ChatType.ChatNone;
}
else if (lowMsg.StartsWith("!highestping"))
{
ServerClient HPclient = getHighestPingPlayer();
if(HPclient == null)
TellClient(Client.ClientNum, "^2Ping plugin: ^1Highest ping search failed! ", true);
else
TellClient(Client.ClientNum, "^2Ping plugin:^7 Player \'" + HPclient.Name + "\' has the highest ping with " + HPclient.Ping, true);
return ChatType.ChatNone;
}
else if (lowMsg.StartsWith("!lowestping"))
{
ServerClient LPclient = getLowestPingPlayer();
if(LPclient ==null)
TellClient(Client.ClientNum, "^2Ping plugin: ^1Lowest ping search failed! ", true);
else
TellClient(Client.ClientNum, "^2Ping plugin:^7 Player \'" + LPclient.Name + "\' has the lowest ping with " + LPclient.Ping, true);
return ChatType.ChatNone;
}
return ChatType.ChatContinue;
}
//////////////////////////////////////////////////////////////////////////////////////
ServerClient GetClientByName(string name)
{
if (name == null)
return null;
ServerClient C = null;
int maxclients = Convert.ToInt32(GetDvar("sv_maxclients"));
for (int i = 0; i < maxclients; i++)
{
C = GetClient(i);
if (C != null)
{
if (C.Name.StartsWith(name, StringComparison.InvariantCultureIgnoreCase))
return C;
else if (C.Name.ToLower().Contains(name.ToLower()))
return C;
}
}
return null;
}
//////////////////////////////////////////////////////////////////////////////////////
public ServerClient getHighestPingPlayer()
{
int Lowest = 0;
ServerClient client = null;
ServerClient last = null;
for (int i = 0; i < 18; i++)
{
client = GetClient(i);
if (client == null)
continue;
if (client.Ping > Lowest && client.Ping != 999)
{
last = client;
Lowest = client.Ping;
}
}
return last;
}
//////////////////////////////////////////////////////////////////////////////////////
public ServerClient getLowestPingPlayer()
{
int highest = 999;
ServerClient client = null;
ServerClient last = null;
for (int i = 0; i < 18; i++)
{
client = GetClient(i);
if (client == null)
continue;
if (client.Ping < highest && client.Ping != 0)
{
last = client;
highest = client.Ping;
}
}
return last;
}
}
}