- Geo_GetIP(playerid); // Get the IP for a player (same as GetPlayerIP) - Geo_GetAllData(playerid); // Get a string of all player data. - Geo_GetCountry(playerid); // Get the player country as a string - Geo_GetCountryCode(playerid); // Get the player country Code as a string (Ex: RO, US, PL, NL) - Geo_GetCity(playerid); // Get the player city as a string - Geo_GetRegionCode(playerid) ; // Get the player region code as a string (Ex: CA, LA, LS) - Geo_GetRegion(playerid); // Get the player region as a string - Geo_GetZipCode(playerid); // Get the player Zip code as a integer - Geo_GetTimeZone(playerid); // Get the player time zone as a string (Ex: Europe/Bucharest) - Geo_GetLatitude(playerid); // Get the player latitude as a float - Geo_GetLongitude(playerid); // Get the player longitude as a float - Geo_GetMetroCode(playerid); // Get the player metro code as a integer
It's a good idea however if that site is down then this isn't going to work which would likely be an exceptional circumstance. So yeah I would say it's pretty cool with only limited issues.
|
What I do for geoip is run a python script that downloads geoip data then processes it into a sqlite database so no worries for latency
![]() |
// Stock function for retrieving GeoIP data stock GetGeoIP(ip, country_code[3], country[32], region_code[32], region[64], city[64], zipcode[16], lat[16], lng[16], metro[16], area[16]) { if (!query[0]) { strimplode(" ", query, sizeof(query), "SELECT", "`city_location`.`country_code`,", "`country_blocks`.`country_name`,", "`city_location`.`region_code`,", "`region_names`.`region_name`,", "`city_location`.`city_name`,", "`city_location`.`postal_code`,", "`city_location`.`latitude`,", "`city_location`.`longitude`,", "`city_location`.`metro_code`,", "`city_location`.`area_code`", "FROM `city_blocks`", "NATURAL JOIN `city_location`", "INNER JOIN `country_blocks` ON `city_location`.`country_code` = `country_blocks`.`country_code`", "LEFT OUTER JOIN", "`region_names` ON `city_location`.`country_code` = `region_names`.`country_code`", "AND `city_location`.`region_code` = `region_names`.`region_code`", "WHERE `city_blocks`.`ip_start` <= ?", "ORDER BY `city_blocks`.`ip_start`", "DESC ", "LIMIT 1"); stmt = db_prepare(GeoIP, query); } // Bind DB Results to DB Variables stmt_bind_result_field(stmt, 0, DB::TYPE_STRING, country_code, sizeof(country_code)); stmt_bind_result_field(stmt, 1, DB::TYPE_STRING, country, sizeof(country)); stmt_bind_result_field(stmt, 2, DB::TYPE_STRING, region_code, sizeof(region_code)); stmt_bind_result_field(stmt, 3, DB::TYPE_STRING, region, sizeof(region)); stmt_bind_result_field(stmt, 4, DB::TYPE_STRING, city, sizeof(city)); stmt_bind_result_field(stmt, 5, DB::TYPE_STRING, zipcode, sizeof(zipcode)); stmt_bind_result_field(stmt, 6, DB::TYPE_STRING, lat, sizeof(lat)); stmt_bind_result_field(stmt, 7, DB::TYPE_STRING, lng, sizeof(lng)); stmt_bind_result_field(stmt, 8, DB::TYPE_STRING, metro, sizeof(metro)); stmt_bind_result_field(stmt, 9, DB::TYPE_STRING, area, sizeof(area)); // Set the IP for the query stmt_bind_value(stmt, 0, DB::TYPE_UINT, ip); // Execute DB Query if (stmt_execute(stmt)) { // Found a result if (stmt_fetch_row(stmt)) return 1; } return 0; }
// Get InterIP - Slice stock GetIntegerIP(const input[]) { new ip = 0, pos = -1; for (new i = 24; i >= 0; i -= 8) { ip |= strval(input[++pos]) << i; if (i) { pos = strfind(input, ".", _, pos); } } return ip; }