#include <sourcemod>
#include <sourcetvmanager>
#include <geoip>

#pragma newdecls required

public Plugin myinfo = {
	name = "SourceTV",
	author = "BotoX",
	description = "SourceTV",
	version = "1.0",
	url = ""
}

public void OnPluginStart()
{

}

public void SourceTV_OnSpectatorPutInServer(int client)
{
	static char sName[64];
	static char sIP[16];
	static char sCountry[32];

	SourceTV_GetClientName(client, sName, sizeof(sName));

	if(SourceTV_GetClientIP(client, sIP, sizeof(sIP)) && GeoipCountry(sIP, sCountry, sizeof(sCountry)))
		PrintToChatAll("\x04[\x03SourceTV\x04] %s connected from %s", sName, sCountry);
	else
		PrintToChatAll("\x04[\x03SourceTV\x04] %s connected", sName);
}

public Action SourceTV_OnSpectatorChatMessage(int client, char message[255], char chatgroup[255])
{
	PrintToChatAll("\x04[\x03SourceTV\x04]\x01 %s", message);
	return Plugin_Handled;
}