AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   General (https://forums.alliedmods.net/forumdisplay.php?f=7)
-   -   [ Help ] GeoLite2-City (https://forums.alliedmods.net/showthread.php?t=308449)

Fuck For Fun 06-20-2018 15:14

[ Help ] GeoLite2-City
 
if i upload - GeoLite2-City.mmdb
and update all geoip, why player connect is show City: Burgas wrong location? but the player from Varna

Code:

#include <geoip>
szCity[21]
geoip_city(szIP, szCity, charsmax(szCity))


OciXCrom 06-20-2018 17:18

Re: [ Help ] GeoLite2-City
 
Because that's how correct the internet provider is. Nothing to do with the plugin.

Fuck For Fun 06-20-2018 17:29

Re: [ Help ] GeoLite2-City
 
Quote:

Originally Posted by OciXCrom (Post 2598268)
Because that's how correct the internet provider is. Nothing to do with the plugin.

oh okay, and if the city: none shown?

there is not way to do something?
Code:

        get_user_ip(id, szIP, charsmax(szIP))
        geoip_country(szIP, szCountry, charsmax(szCountry))
        geoip_city(szIP, szCity, charsmax(szCity))


OciXCrom 06-20-2018 21:44

Re: [ Help ] GeoLite2-City
 
It doesn't have anything to do with the plugin. It depends on the player's IP address.

tarsisd2 06-21-2018 04:22

Re: [ Help ] GeoLite2-City
 
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);



Fuck For Fun 06-21-2018 08:56

Re: [ Help ] GeoLite2-City
 
Quote:

Originally Posted by tarsisd2 (Post 2598356)
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


All times are GMT -4. The time now is 17:59.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.