SA-MP Forums

Go Back   SA-MP Forums > SA-MP Scripting and Plugins > Filterscripts > Includes

Reply
 
Thread Tools Display Modes
Old 09/04/2020, 08:44 PM   #31
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: GeoLite

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?
__________________
Calisthenics is offline   Reply With Quote
Old 06/05/2020, 10:13 AM   #32
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: GeoLite

Databases were updated for May 2020: https://github.com/George480/geolite/releases/tag/v19.0
__________________
Calisthenics is offline   Reply With Quote
Old 19/05/2020, 04:22 PM   #33
Feanor
Little Clucker
 
Join Date: Jan 2019
Posts: 1
Reputation: 0
Default Re: GeoLite

Calisthenics, I wrote you PM regarding your include.

Could you please check it out?
Feanor is offline   Reply With Quote
Old 25/05/2020, 08:08 PM   #34
JR_Junior
Huge Clucker
 
Join Date: Nov 2011
Location: Brazil
Posts: 231
Reputation: 54
Default Re: GeoLite

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!
JR_Junior is online now   Reply With Quote
Old 25/05/2020, 08:32 PM   #35
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: GeoLite

`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);
__________________
Calisthenics is offline   Reply With Quote
Old 25/05/2020, 08:58 PM   #36
JR_Junior
Huge Clucker
 
Join Date: Nov 2011
Location: Brazil
Posts: 231
Reputation: 54
Default Re: GeoLite

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.
JR_Junior is online now   Reply With Quote
Old 25/05/2020, 09:16 PM   #37
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: GeoLite

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;
}
__________________
Calisthenics is offline   Reply With Quote
Old 25/05/2020, 09:41 PM   #38
JR_Junior
Huge Clucker
 
Join Date: Nov 2011
Location: Brazil
Posts: 231
Reputation: 54
Default Re: GeoLite

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!
JR_Junior is online now   Reply With Quote
Old 03/06/2020, 02:00 PM   #39
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: GeoLite

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.
__________________
Calisthenics is offline   Reply With Quote
Old 08/07/2020, 03:10 PM   #40
Calisthenics
High-roller
 
Join Date: May 2018
Posts: 1,228
Reputation: 205
Default Re: GeoLite

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.
__________________

Last edited by Calisthenics; 09/07/2020 at 03:55 PM.
Calisthenics is offline   Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



All times are GMT. The time now is 12:17 AM.


Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.