[Include] GeoLite
#21

Databases were updated for February 2020: https://github.com/George480/geolite/releases/tag/v16.0
Reply
#22

For those of you (non-sampctl users) that use community compiler version 3.10.10 (released an hour ago), you will need to modify a_sampdb.inc and change lines 12 and 14:
pawn Code:
native DB:db_open(name[]);
native DBResult:db_query(DB:db, query[]);
to:
pawn Code:
native DB:db_open(const name[]);
native DBResult:db_query(DB:db, const query[]);
in order to fix warning 239: literal array/string passed to a non-const parameter.
Reply
#23

Great job, glad you could improve upon what I made some years back!
Reply
#24

Quote:
Originally Posted by Whitetiger
View Post
Great job, glad you could improve upon what I made some years back!
Thank you, I appreciate it.
Reply
#25

Databases were updated for March 2020: https://github.com/George480/geolite/releases/tag/v17.0
Reply
#26

Hi, is it possible to add an IP address to exceptions? I have a lot of regular players and can't play, thanks in advance for your help

I want to unlock ip players not locations


Code:
if(!IsAdminPlayer(playerid))
	{
		{
			if(strcmp(player_country, "Egypt", true))
			{
 				BoxInfo(playerid, ""RED""GOLD"Entries from foreign IPs have been blocked");

                KickPlayer(playerid, -1, "Foreign IP");

            }
		}
    }
Reply
#27

Quote:
Originally Posted by PurmeX
View Post
Hi, is it possible to add an IP address to exceptions? I have a lot of regular players and can't play, thanks in advance for your help

I want to unlock ip players not locations


Code:
if(!IsAdminPlayer(playerid))
	{
		{
			if(strcmp(player_country, "Egypt", true))
			{
 				BoxInfo(playerid, ""RED""GOLD"Entries from foreign IPs have been blocked");

                KickPlayer(playerid, -1, "Foreign IP");

            }
		}
    }
Hello, adding an exception to current tables cannot be done because it saves them as IP ranges. However you can create your own whitelist for IPs or names to allow them join in case they are outside of Egypt.
Reply
#28

Thank you
Reply
#29

Databases were updated for April 2020: https://github.com/George480/geolite/releases/tag/v18.0
Reply
#30

Thank you, may come in handy for sure.

Is it possible to categorize countries in order to make a top 10?
Reply
#31

City in Veracruz, Mexico is 108 characters long. Updated `MAX_CITY_LENGTH` constant, please re-download the include file: https://raw.githubusercontent.com/Ge...er/geolite.inc
or change it manually to 109.

Quote:
Originally Posted by Symon
View Post
Is it possible to categorize countries in order to make a top 10?
What do you mean? From which country most players were connected?
Reply
#32

Databases were updated for May 2020: https://github.com/George480/geolite/releases/tag/v19.0
Reply
#33

Calisthenics, I wrote you PM regarding your include.

Could you please check it out?
Reply
#34

Is not working for me:

new string[50];
GetPlayerCountry(playerid, string, sizeof(string));
strmid(PlayerInfo[playerid][GeoCountry], string, 0, sizeof(string), 255);

GetPlayerCity(playerid, string, sizeof(string));
strmid(PlayerInfo[playerid][GeoCity], string, 0, sizeof(string), 255);

No data in the string!
Reply
#35

`maxmind_country.db` and `maxmind_city.db` must be located in scriptfiles folder otherwise the functions will return 0.

pawn Code:
GetPlayerCountry(playerid, PlayerInfo[playerid][GeoCountry], MAX_COUNTRY_LENGTH);
GetPlayerCity(playerid, PlayerInfo[playerid][GeoCity], MAX_CITY_LENGTH);
Reply
#36

Quote:
Originally Posted by Calisthenics
View Post
`maxmind_country.db` and `maxmind_city.db` must be located in scriptfiles folder otherwise the functions will return 0.

pawn Code:
GetPlayerCountry(playerid, PlayerInfo[playerid][GeoCountry], MAX_COUNTRY_LENGTH);
GetPlayerCity(playerid, PlayerInfo[playerid][GeoCity], MAX_CITY_LENGTH);
All files is on the correct place and I've tried getting info like this way too... but nothing, no errors, but no data too.
Reply
#37

Quote:
Originally Posted by JR_Junior
View Post
All files is on the correct place and I've tried getting info like this way too... but nothing, no errors, but no data too.
Database files in correct place, correct permissions to read from scriptfiles and connected (in case you use it on another player). Here is a sample with correct output:
pawn Code:
#include <a_samp>
#include <sscanf2>
#include <geolite>
#include <zcmd>

enum e_PlayerInfo
{
    GeoCountry[MAX_COUNTRY_LENGTH],
    GeoCity[MAX_CITY_LENGTH]
};

new PlayerInfo[MAX_PLAYERS][e_PlayerInfo];

CMD:mycountry(playerid, params[])
{
    if (isnull(PlayerInfo[playerid][GeoCountry]) && isnull(PlayerInfo[playerid][GeoCity]))
    {
        GetPlayerCountry(playerid, PlayerInfo[playerid][GeoCountry], MAX_COUNTRY_LENGTH);
        GetPlayerCity(playerid, PlayerInfo[playerid][GeoCity], MAX_CITY_LENGTH);
    }
   
    printf("Country: %s, City: %s", PlayerInfo[playerid][GeoCountry], PlayerInfo[playerid][GeoCity]);
    return 1;
}
Reply
#38

Quote:
Originally Posted by Calisthenics
View Post
Database files in correct place, correct permissions to read from scriptfiles and connected (in case you use it on another player). Here is a sample with correct output:
pawn Code:
#include <a_samp>
#include <sscanf2>
#include <geolite>
#include <zcmd>

enum e_PlayerInfo
{
    GeoCountry[MAX_COUNTRY_LENGTH],
    GeoCity[MAX_CITY_LENGTH]
};

new PlayerInfo[MAX_PLAYERS][e_PlayerInfo];

CMD:mycountry(playerid, params[])
{
    if (isnull(PlayerInfo[playerid][GeoCountry]) && isnull(PlayerInfo[playerid][GeoCity]))
    {
        GetPlayerCountry(playerid, PlayerInfo[playerid][GeoCountry], MAX_COUNTRY_LENGTH);
        GetPlayerCity(playerid, PlayerInfo[playerid][GeoCity], MAX_CITY_LENGTH);
    }
   
    printf("Country: %s, City: %s", PlayerInfo[playerid][GeoCountry], PlayerInfo[playerid][GeoCity]);
    return 1;
}
My VPS was blocked the db files to be readed... now is working! Thank You!
Reply
#39

Databases were updated for June 2020: https://github.com/George480/geolite/releases/tag/v20.0

Update geolite.inc: https://raw.githubusercontent.com/Ge...er/geolite.inc
  • Added new database maxmind_province.db requested by Walter-Correa
  • Added two new functions:
    pawn Code:
    native GetIpProvince(const geolite_ip[], geolite_dest[], geolite_len = sizeof (geolite_dest));
    native GetPlayerProvince(playerid, geolite_dest[], geolite_len = sizeof (geolite_dest));
NOTE: This version includes many duplicated province names because it was slow to re-arrange geoname_id with a unique id for 2.5 millions rows. If I manage to find a way to do it, the size of maxmind_province.db will be reduced drastically.
Reply
#40

Databases were updated for July 2020: https://github.com/George480/geolite/releases/tag/v21.0

Province database will be uploaded tomorrow because it takes too long.

EDIT: I was unable to get the province database, timed out twice for taking too long.
Reply


Forum Jump:


Users browsing this thread: 4 Guest(s)