GeoIP

Started by Crys, Sep 14, 2015, 08:22 AM

Previous topic - Next topic

rww

Quote from: =RK=MarineForce on Jul 20, 2018, 09:56 AMhey bro i can't install this properly. can u help me?


i have downloaded plugin geoip.dat in my server but didn't work don''t sending data into joining server when player join it will show message but not showing .

updated untested
    if (country == null) reutrn "unknow");

you have geoip.dat in main server folder?

and put it to onPlayerJoin/onPlayerPart, and check console after join to the server

print("Test geoip: "+geoip_country_name_by_addr(player.IP));
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

=RK=MarineForce

#46
https://ibb.co/fcZ68d

function onPlayerJoin( player )
{
print("Test geoip: "+geoip_country_name_by_addr(player.IP));
Stats[ player.ID ] = PlayerClass();
NewTimer( "CheckBan", 1000, 1, player.ID );
Message("[#00CC00]** [#ffffff]"+player.Name+" [#00cc00]Has Joined The Server");
stats[ player.ID ] = PlayerClass();
GetInfo(player);
}

rww

Quote from: =RK=MarineForce on Jul 20, 2018, 10:06 AMhttps://ibb.co/fcZ68d

function onPlayerJoin( player )
{
print("Test geoip: "+geoip_country_name_by_addr(player.IP));
Stats[ player.ID ] = PlayerClass();
NewTimer( "CheckBan", 1000, 1, player.ID );
Message("[#00CC00]** [#ffffff]"+player.Name+" [#00cc00]Has Joined The Server");
stats[ player.ID ] = PlayerClass();
GetInfo(player);
}

Localhost IP (127.0.0.1) isn't exist on geoip.dat
Join to Irrelevant Club Discord: https://discord.gg/MsPPZ5uV4X

Crys

Quote from: rww on Jul 20, 2018, 10:48 AM
Quote from: =RK=MarineForce on Jul 20, 2018, 10:06 AMhttps://ibb.co/fcZ68d

function onPlayerJoin( player )
{
print("Test geoip: "+geoip_country_name_by_addr(player.IP));
Stats[ player.ID ] = PlayerClass();
NewTimer( "CheckBan", 1000, 1, player.ID );
Message("[#00CC00]** [#ffffff]"+player.Name+" [#00cc00]Has Joined The Server");
stats[ player.ID ] = PlayerClass();
GetInfo(player);
}

Localhost IP (127.0.0.1) isn't exist on geoip.dat

Localhost won't work indeed - local IP addresses are not delegated to any entity, so they don't have a country by design. Try it with a remote client's IP address. It works for me:
[MODULE] Loaded GeoIP for 0.4 by Crys.
            >> Loaded GeoIP.dat (GeoIP Country Edition)
[SCRIPT] === GeoIP DEBUG ===
[SCRIPT] - Database info: GEO-106FREE 20180719 Build 1 Copyright (c) 2018 MaxMind Inc All Rights Reserved
[SCRIPT] - Number of countries: 256
[SCRIPT] - Library version: 1.6.12
[SCRIPT] - Character set: UTF-8
[SCRIPT] geoip_country_code_by_addr("78.24.185.47") = "HU"
[SCRIPT] geoip_country_code3_by_addr("78.24.185.47") = "HUN"
[SCRIPT] geoip_country_name_by_addr("78.24.185.47") = "Hungary"

This is the script that I'm using for debugging:
function onScriptLoad() {
    local testIP = "78.24.185.47";
    print("=== GeoIP DEBUG ===");
    print("- Database info: " + geoip_database_info());
    print("- Number of countries: " + geoip_num_countries());
    print("- Library version: " + geoip_lib_version());
    print("- Character set: " + (geoip_charset() == GEOIP_CHARSET_UTF8 ? "UTF-8" : "ISO-8859-1"));
    print("geoip_country_code_by_addr(\"" + testIP + "\") = \"" + geoip_country_code_by_addr(testIP) + "\"");
    print("geoip_country_code3_by_addr(\"" + testIP + "\") = \"" + geoip_country_code3_by_addr(testIP) + "\"");
    print("geoip_country_name_by_addr(\"" + testIP + "\") = \"" + geoip_country_name_by_addr(testIP) + "\"");
}

=RK=MarineForce

thats why cool :D