It's been over 3 years since I released any Script. But, now I am giving you the Version 2.0 (Updated to 2.1 on 12/31/2012) of the Legen ... wait for it ... dary Geo-IP Script. Earlier version was a simple filterscript that worked on the file handling method. But this one is better and uses SQLite Database instead of plan old file handling way.NOTE : Read the Change Log below to know about the changes made in recent versions of the script.
The GEO-IP Script helps to provide the Geographical Location of a any player according to his/her Public IP Address. But, do not expect too much accurate results. The results will be somewhere near to the exact location. Using this script is very easy and does not needs much experience of scripting.۞ SUB VERSIONS
FULL۞ USAGELITE
- Gives Country, State and City Location.
- Uses a BIG Database (114MB)
- Might lag on slow/personal servers (like 1 sec lag when someone joins)
- Gives Country Location only.
- Uses a Small Database (2.82MB)
- Comparatively much faster
FULL۞ FUNCTIONSLITE
- Remove any old version(s) of GEO-IP / GEO-IP Lite or there are chances that newer version will show some glitches.
- Extract the contents of the archive into your SAMP Server directory OR Manually place all the files from the archives to the respective folders in the SAMP server directory.
- Now open your filterscript and add
just below #include <a_samp>Код:#include <geo_ip>- Now you can use the function anywhere like this
ORКод:new Country[16], State[128], City[128]; isLocal=GetPlayerLocation(playerid,Country,State,City);
The third parameter is optional. It is isotype parameter. You will find more info about it below, in the FUNCTIONS section.Код:new Country[16], State[128], City[128]; isLocal=GetPlayerLocation(playerid,Country,State,City,1);
- 1st step same as above.
- Now open your filterscript and add
just below #include <a_samp>Код:#include <geo_ip_lite>- Now you can use the function anywhere like this
ORКод:new Country[16]; isLocal=GetPlayerLocation(playerid,Country);
The third parameter is optional. It is isotype parameter. You will find more info about it below, in the FUNCTIONS section.Код:new Country[16]; isLocal=GetPlayerLocation(playerid,Country,1);
FULL۞ DOWNLOADSLITE
- GetPlayerLocation(playerid, Country[],State[], City[],isotype);
- Returns 0 when connecting to the local server, otherwise 1.
- Country[] hold the string of the country name and "Localhost" is you are connecting to local server.
- State[] and City[] hold the string values of the State and City for the give IP.
- isotype (OPTIONAL) is set to 2 by default and is an optional parameter. The valid values for isotype are :
- 0 (Default) = 2 Alphabet name. Like IN
- 1 = 3 Alphabet name. Like IND
- 2 = Full Country Name. Like INDIA
- GetPlayerCountry(playerid,isotype);
- Returns the Country as string (according to the isotype, if provided, as isotype is default to 2 for this one).
- GetPlayerProvince(playerid);
- Returns the State/Province as string.
- GetPlayerCity(playerid);
- Returns the City as string.
- GetPlayerLocation(playerid, Country[],isotype);
- Returns 0 when connecting to the local server, otherwise 1.
- Country[] hold the string of the country name and "Localhost" is you are connecting to local server.
- isotype (OPTIONAL) is set to 2 by default and is an optional parameter. The valid values for isotype are :
- 0 = 2 Alphabet name. Like IN
- 1 = 3 Alphabet name. Like IND
- 2(Default) = Full Country Name. Like INDIA
- GetPlayerCountry(playerid,isotype);
- Returns the Country as string.
4Shared Links MegaCloud Links۞ CHANGE LOG
۞ CREDITS
- FIXES
- FULL 2.1/LITE 2.1 : Compiler crash due to native function prototypes inside the include script.
- LITE 2.1 : Wrong Database name. It was using the FULL DATABASE for operation instead of LITE one.
- FEATURES
- FULL 2.0/LITE 2.0 : Now the script works using a SQLite Database and not the CSV file (as it was slower and messy). Improved execution speed and HUGE database (FULL version).
- FULL 2.0 : Now you can get names of States and Cities along with the Country name for any IP.
- FULL 2.1 / LITE 2.1 : Now you can choose the Country Name Type by passing the opional parameter isotype. It has 3 options, 2 alphabet name, 3 alphabet name, and full name. (READ MORE in FUNCTIONS section)
You are most welcomed to inform me about any bugs/improvements and all other type of feedback in/of this script. I'd be more than glad to help.
Good job, if you could also upload it to something else, except 4Shared, then it'd be amazing!
|
[17:39:19] >>GEO-IP<< Dwane from has joined the server. |
You bought the whole location DB? Pro
Good to see one of SA-MP's useful includes updated! |
public OnPlayerConnect(playerid)
{
new isLocal;
new Country[16];
isLocal=GetPlayerLocation(playerid,Country);
new message[256];
if(!isLocal)
{
format(message,sizeof(message),">>GEO-IP<< %s from Localhost has joined the server.",GetPName(playerid));
printf(message);
}
else
{
format(message,sizeof(message),">>GEO-IP<< %s from %s has joined the server.",GetPName(playerid),Country);
printf(message);
}
SendClientMessageToAll(COLOR_JOIN,message);
return 1;
}
>>GEO-IP<< Dwane from has joined the server. |
I used the filterscript you had on the package with this OnPlayerConnect
pawn Код:
|
Can you post a Pastebin link, since I am in my iPad? Thanks again in advance
|
Awesome. <3
Can you make GetPlayerCountryCode ? Like "uk", "usa", "ro", "ru", "pl", "de" ... ? |
>>GEO-IP<< CodeWave from (IN) Uttarakhand, Dehradun has joined the server
I'd still like to point out that plugin implementations using the MaxMind GeoIP API are a lot faster than any PAWN scripts reading the data from a SQL database for example.
Although it has been like 4 years since the original plugin was released and 2 years since Remis updated it, the API has not been through a lot of changes from version 1.4.6 to 1.4.8. So the version I linked to is still worth using! @costel_nistor96: the plugin I mentioned supports country codes - both 2 or 3 characters ![]() |
Uhh!
I use the latest full version. I'm hungarian and it write me ![]() I'm hungarian I'm live in Hajdъbцszцrmйny.... Pls someone tell me what is wrong? ![]() ![]() |