View Single Post
Moody92
Veteran Member
Join Date: May 2011
Location: Oman
Old 08-19-2013 , 18:55   Re: Country and city connect
Reply With Quote #23

Geo IP extended serves what he needs 'showing the country and the city' http://forums.alliedmods.net/showthread.php?t=95665

I've seen such a plugin long time ago, It was in suggestion request but unfortunately I do not recall it
It was a plugin when you write amx_ip it shows country,city everything... of course these could be edited to show in connect message.

EDIT: Here, found it.. http://forums.alliedmods.net/showthread.php?t=182011 you're gonna need to read the first topic first, then it's easy to edit it to show as connect message. If no one makes it till tomorrow I'll make it, I have to go sleep now..

EDIT2 : It's not optimized as the other plugins that members gave but it should give you the same result as the picture you posted

CVars :
amx_connect_message 1 (0 to disable)
amx_disconnect_message 1 (0 to disable)

Installation :
1. Download GeoLiteCity then extract it to data folder ( /amxmodx/data/ ) and rename it to GeoIPCity.dat.
2. Download http://forums.alliedmods.net/showthread.php?t=95665 attachments and place each in the right folder (geoip.inc --> scripting/include) (geoip_amxx.dll or geoip_amxx_i386.so --> modules)
3. Take the source code below and compile it locally

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 country and city""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(idnamecharsmax(name));
    
get_user_ip(idipcharsmax(ip), 1);
    
geoip_country(ipcountrycharsmax(country));
    
geoip_city(ipcitycharsmax(city));
    
    
ChatColor(0"!g%s !yconnected from [!team%s!y] [!team%s!y]"namecountrycity);    
    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(idnamecharsmax(name));
    
get_user_ip(idipcharsmax(ip), 1);
    
geoip_country(ipcountrycharsmax(country));
    
geoip_city(ipcitycharsmax(city));
    
    
ChatColor(0"!g%s !ydisconnected from [!team%s!y] [!team%s!y]"namecountrycity);
    return 
PLUGIN_HANDLED
}
    
// ColorChat
stock ChatColor(const id, const input[], any:...)
{
    new 
count 1players[32]
    static 
msg[191]
    
vformat(msg190input3)
    
    
replace_all(msg190"!g""^4"// Green Color
    
replace_all(msg190"!y""^1"// Default Color
    
replace_all(msg190"!team""^3"// Team Color

    
    
if (idplayers[0] = id; else get_players(playerscount"ch")
    {
        for (new 
0counti++)
        {
            if (
is_user_connected(players[i]))
            {
            
message_begin(MSG_ONE_UNRELIABLEg_iMsgSayText_players[i])  
            
write_byte(players[i]);
            
write_string(msg);
            
message_end();
            }
        }
    }


Last edited by Moody92; 08-20-2013 at 09:30.
Moody92 is offline