Quote from: rww on Jul 20, 2018, 10:48 AMQuote 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:
Code Select
[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:
Code Select
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) + "\"");
}