View Single Post
Fuck For Fun
Veteran Member
Join Date: Nov 2013
Old 06-21-2018 , 08:56   Re: [ Help ] GeoLite2-City
Reply With Quote #6

Quote:
Originally Posted by tarsisd2 View Post
you can try to use sxgeo module, and use this plugin, or based on it!

PHP Code:
#include <amxmodx>
#include <sxgeo>

#if (AMXX_VERSION_NUM < 183) || defined NO_NATIVE_COLORCHAT
    #include <colorchat>
#else
    #define DontChange print_team_default
    #define client_disconnect client_disconnected
#endif

#pragma semicolon 1

new const PREFIX[]        = "^4[SxGeo]";
new const 
CONNECT_SOUND[] = "buttons/blip1.wav";

new 
g_pcvar_amx_language;

public 
plugin_init()
{
    
register_plugin("[SxGeo] Connect Info""1.0""s1lent");
    
register_dictionary("sxgeo_connect_info.txt");

    
g_pcvar_amx_language get_cvar_pointer("amx_language");
}

public 
client_putinserver(id)
{
    new 
szLanguage[3];
    
get_pcvar_string(g_pcvar_amx_languageszLanguagecharsmax(szLanguage));

    new 
szName[32], szIP[16];
    
get_user_name(idszNamecharsmax(szName));
    
get_user_ip(idszIPcharsmax(szIP), /*strip port*/ 0);

    new 
szCountry[64], szRegion[64], szCity[64];

    new 
bool:bCountryFound sxgeo_country(szIPszCountrycharsmax(szCountry), /*use lang server*/ szLanguage);
    new 
bool:bRegionFound  sxgeo_region (szIPszRegion,  charsmax(szRegion),  /*use lang server*/ szLanguage);
    new 
bool:bCityFound    sxgeo_city   (szIPszCity,    charsmax(szCity),    /*use lang server*/ szLanguage);

    if (
bCountryFound && bCityFound && bRegionFound)
    {
        
client_print_color(0DontChange"%s %L %L^3 %s ^4(%s, %s)"PREFIXLANG_SERVER"CINFO_JOINED"szNameLANG_SERVER"CINFO_FROM"szCityszRegionszCountry);
    }
    else if (
bCountryFound && bRegionFound)
    {
        
client_print_color(0DontChange"%s %L %L^3 %s ^4(%s)"PREFIXLANG_SERVER"CINFO_JOINED"szNameLANG_SERVER"CINFO_FROM"szRegionszCountry);
    }
    else if (
bCountryFound)
    {
        
client_print_color(0DontChange"%s %L %L^4 %s"PREFIXLANG_SERVER"CINFO_JOINED"szNameLANG_SERVER"CINFO_FROM"szCountry);
    }
    else
    {
        
// we don't know where you are :(
        
client_print_color(0DontChange"%s %L^4 ..."PREFIXLANG_SERVER"CINFO_JOINED"szName);
    }

    
client_cmd(0"spk %s"CONNECT_SOUND);

I read a little about the sxgeo but i cant find the include... is wrong include there is only SxGeoCity, it's based on the same FUNC as GEOIP there is almost no difference

Last edited by Fuck For Fun; 06-21-2018 at 09:04.
Fuck For Fun is offline
Send a message via Skype™ to Fuck For Fun