29.12.2012, 22:16
(
Последний раз редактировалось abhinavdabral; 30.03.2015 в 03:33.
Причина: Released Version 3.1
)
VERSION 3.1 Updated (30/Mar/2015)
No need to use the one below (unless you really need to), just visit the above link!
No need to use the one below (unless you really need to), just visit the above link!
۞ HISTORY
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.
۞ DESCRIPTION
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)
- Database : http://db-ip.com/
- Everything Else (Database Conversion/Scripting etc) : Abhinav Dabral (ALIAS: Code Wave) [******** | *******]
۞ SUPPORT
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.