SourcePawn:Unconnected

From Devicenull's Code

Jump to: navigation, search

This kicks players who exploit setinfo to join with no name

#pragma semicolon 1
#include <sourcemod>
#include <irc-relay>
 
#define VERSION "0.0.1.0"
public Plugin:myinfo = 
{
	name = "Unconnected detection",
	author = "devicenull",
	description = "kicks unconnected players",
	version = VERSION,
	url = "http://www.devicenull.org/"
};
 
public CheckName(client)
{
	decl String:name[256];
	GetClientName(client,name,256);
	if (strlen(name) == 0)
	{
		decl String:ip[32];
		decl String:steamid[64];
		decl String:message[256];
		GetClientIP(client,ip,32);
		GetClientAuthString(client,steamid,64);
		Format(message,256,"Removing %s (%s) for not having a name",steamid,ip);
		ServerCommand("kickid %s Please set a name",steamid);
		IRC_Broadcast(IRC_CHANNEL_PRIVATE,"noobs");
	}
}
 
public OnClientPostAdminCheck(client)
{
	CheckName(client);	
}
 
public OnClientSettingsChanged(client)
{
	CheckName(client);
}