PHP Code:
/* Plugin generated by AMXX-Studio */
#include <amxmodx>
#include <amxmisc>
#include <geoip>
new g_iMsgSayText;
new connect;
new disconnect;
public plugin_init() {
register_plugin("Connect message with city and country", "1.0", "Moody92");
// ColorChat
g_iMsgSayText = get_user_msgid("SayText");
// Enable and disable cvars
connect = register_cvar("amx_connect_message", "1");
disconnect = register_cvar("amx_disconnect_message", "1");
}
public client_putinserver(id){
if(get_pcvar_num(connect) == 0)
return PLUGIN_HANDLED
static name[32];
static ip[16];
static country[45];
static city[45];
get_user_name(id, name, charsmax(name));
get_user_ip(id, ip, charsmax(ip), 1);
geoip_city(ip, city, charsmax(city));
geoip_country(ip, country, charsmax(country));
ChatColor(0, "!y[Player Info]!g%s !yconnected from [!team%s!y] [!g%s!y]", name, city, country);
return PLUGIN_HANDLED
}
public client_disconnect(id){
if(get_pcvar_num(disconnect) == 0)
return PLUGIN_HANDLED
static name[32];
static ip[16];
static country[45];
static city[45];
get_user_name(id, name, charsmax(name));
get_user_ip(id, ip, charsmax(ip), 1);
geoip_city(ip, city, charsmax(city));
geoip_country(ip, country, charsmax(country));
ChatColor(0, "!y[Player Info]!g%s !ydisconnected from [!team%s!y] [!g%s!y]", name, city, country);
return PLUGIN_HANDLED
}
// ColorChat
stock ChatColor(const id, const input[], any:...)
{
new count = 1, players[32]
static msg[191]
vformat(msg, 190, input, 3)
replace_all(msg, 190, "!g", "^4") // Green Color
replace_all(msg, 190, "!y", "^1") // Default Color
replace_all(msg, 190, "!team", "^3") // Team Color
if (id) players[0] = id; else get_players(players, count, "ch")
{
for (new i = 0; i < count; i++)
{
if (is_user_connected(players[i]))
{
message_begin(MSG_ONE_UNRELIABLE, g_iMsgSayText, _, players[i])
write_byte(players[i]);
write_string(msg);
message_end();
}
}
}
}