PHP Code:
/* Formatright ɠ2010, ConnorMcLeod
This plugin is free software;
you can redistribute it and/or modify it under the terms of the
GNU General Public License as published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this plugin; if not, write to the
Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA.
*/
#include <amxmodx>
#include <geoip>
#define MAX_PLAYERS 32
new g_szCountry[MAX_PLAYERS+1][46]
#define VERSION "0.0.1"
#define PLUGIN "Country Chat"
public plugin_init()
{
register_plugin(PLUGIN, VERSION, "ConnorMcLeod")
register_message(get_user_msgid("SayText"), "Message_SayText")
}
public client_putinserver(id)
{
static szIp[16]
get_user_ip(id, szIp, charsmax(szIp), 1)
geoip_country(szIp, g_szCountry[id], charsmax(g_szCountry[]))
}
public Message_SayText()
{
new id = get_msg_arg_int(1)
new szChannel[40]
get_msg_arg_string(2, szChannel, charsmax( szChannel ) )
if( equal(szChannel, "#Cstrike_Chat", 13) )
{
if( equal(szChannel, "#Cstrike_Chat_All") )
{
format(szChannel, charsmax(szChannel), "^4[%s] ^3%%s1 ^1: %%s2", g_szCountry[id])
}
else
{
format(szChannel, charsmax(szChannel), "^4[%s] %s", g_szCountry[id], szChannel)
}
set_msg_arg_string(2, szChannel)
}
}
__________________