/*
 
 plugin_banmygot.sma
 Author: David vonThenen
 Email: david@checkyour6.net
 IRC: gamesnet #cy6
 Website: http://www.checkyour6.net and http://www.cy6forums.net
 
 For help with this plugin go to http://www.cy6forums.net in the adminmod plugin request section
 
 What the plugin does:
 it checks to see if they connect with that name and it also checks every minute to see if they are playing
 incognito and they change their name midgame. result is auto-permanent ban.
 
 i feel it is better to know if they are coming on. because if you just block their tag using the password protection
 method they just log on with a variation on that name and run rampant on your server until an admin does something about it.
 
 NOTE and DISCLAIMER: do not alter this file or use pieces of it in parts of your program unless giving mention where you
 got/"borrowed" the original from me =)
 
 Now also working on Steam-Servers ([WING] Black Knight)
 
*/
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "1.0a";
 
public ban_mygot() {
 
	new Dead;
	new i;
	new maxplayers = maxplayercount();
	new Name[MAX_NAME_LENGTH];
	new SessionID;
	new Team;
	new WONID;
	new sAuthID[MAX_AUTHID_LENGTH];
 
	for (i=1; i<=maxplayers; i++) {
		if( playerinfo(i,Name,MAX_NAME_LENGTH,SessionID,WONID,Team,Dead,sAuthID)!=0){
			if( strcasestrx( Name , "mygot" ) != -1 || strcasestrx( Name , "myg0t" ) != -1 || strcasestrx( Name , "H1H" ) != -1 || strcasestrx( Name , "HLH" ) != -1 || strcasestrx( Name , "[H]" ) != -1) {
				new Cmd[MAX_DATA_LENGTH];
				snprintf(Cmd, MAX_DATA_LENGTH, "banid 0 %s", sAuthID);
				exec(Cmd);
				exec("writeid");
				kick(Name);
			}
		}
	}
 
}
 
public plugin_connect(HLUserName,HLIP,UserIndex) {
 
	new strName[MAX_NAME_LENGTH];
	new Cmd[MAX_DATA_LENGTH];
	convert_string(HLUserName, strName, MAX_NAME_LENGTH);
 
	if( strcasestrx( strName , "mygot" ) != -1 || strcasestrx( strName , "myg0t" ) != -1 || strcasestrx( strName , "H1H" ) != -1 || strcasestrx( strName , "HLH" ) != -1 || strcasestrx( strName , "[H]" ) != -1) {
		new sAuthID[MAX_AUTHID_LENGTH];
		get_userAuthID(strName, sAuthID);
		snprintf(Cmd, MAX_DATA_LENGTH, "banid 0 %s", sAuthID);
		exec(Cmd);
		exec("writeid");
		kick(strName);
	}
 
	return PLUGIN_CONTINUE;
}
 
public plugin_init() {
  plugin_registerinfo("Admin mygot/HLH banner","Bans all mygot/HLH peeps.",STRING_VERSION);  
  set_timer("ban_mygot", 60, 99999);
 
  return PLUGIN_CONTINUE;
}