/****************************************************************************
* Chat With Your Country! *
* Author: nikhilgupta345 *
* *
* Info: *
* This plugin allows you to talk with people that are only from your *
* country, by using '!' before your message. It will allow only people *
* that are in your country to see it, and it will display the country name *
* beside the message. *
* *
* Along with that, you can also team-chat and country-chat at the same time.*
* So it will show the message only to the people that are on your team and *
* that are in your country. *
* *
* *
* *
* This plugin is useful when you have a lot of people from a different *
* language in your server, or want to keep people in the server because you *
* don't want them to leave because of the different languages spoken. *
* *
* Changelog: *
* v1.0 - Nov. 03, 2010: Plugin first released. *
* *
* Credits: *
* Me - creating the plugin *
* Multiple People - using their plugin's as an idea-base. *
* *
* Installation Instructions: *
* -Click the 'Get Source' Link below. *
* -Place countrychat.sma in your scripting folder. *
* -Add 'colorchat.inc ' to your includes folder. *
* -Run compile.exe *
* *
* Main Plugin Thread: http://forums.alliedmods.net/showthread.php?t=142303 *
* *
****************************************************************************/
#include <amxmodx>
#include <amxmisc>
#include <geoip>
#include <colorchat>
#include <cstrike>
#pragma semicolon 1
new countries[33][46];
new ips[33][30];
public plugin_init()
{
register_plugin( "Country Chat", "1.0", "nikhilgupta345" );
register_clcmd( "say", "cmdSay" );
register_clcmd( "say_team", "cmdSayTeam" );
}
public client_connect( id )
{
get_user_ip( id, ips[id], charsmax( ips ) );
geoip_country( ips[id], countries[id], charsmax( countries ) );
}
public cmdSay( id )
{
if( !equali( countries[id], "error" ) )
{
new message2[200];
read_args( message2, charsmax( message2 ) );
if( message2[1] == '!' )
{
new name[32];
get_user_name( id, name, 31 );
new players[32];
new country[46];
copy( country, charsmax( country ), countries[id] );
new player, num;
get_players( players, num );
for( new i; i < num; i++ )
{
player = players[i];
if( equal( country, countries[player] ) )
ColorChat( player, GREEN, "[%s] ^x03%s: ^x01%s", country, name, message2[1] );
}
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}
public cmdSayTeam( id )
{
if( !equali( countries[id], "error" ) )
{
new message2[200];
read_args( message2, charsmax( message2 ) );
if( message2[1] == '!' )
{
new name[32];
get_user_name( id, name, 31 );
new players[32], country[46];
copy( country, charsmax( country ), countries[id] );
new player, num;
get_players( players, num );
new CsTeams:team = cs_get_user_team( id );
new printTeam[32];
get_user_team( id, printTeam, charsmax( printTeam ) );
for( new i; i < num; i++ )
{
player = players[i];
if( equal( country, countries[player] ) && team == cs_get_user_team( player ) )
ColorChat( i, GREEN, "[%s] ^x01(%s) ^x03%s: ^x01%s", country, printTeam, name, message2[1] );
}
return PLUGIN_HANDLED;
}
}
return PLUGIN_CONTINUE;
}