[Include] GEO-IP (GEOIP) V2 | Supports States and Cities
#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!



۞ 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
  • Gives Country, State and City Location.
  • Uses a BIG Database (114MB)
  • Might lag on slow/personal servers (like 1 sec lag when someone joins)
LITE
  • Gives Country Location only.
  • Uses a Small Database (2.82MB)
  • Comparatively much faster
۞ USAGE
FULL
  1. Remove any old version(s) of GEO-IP / GEO-IP Lite or there are chances that newer version will show some glitches.
  2. 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.
  3. Now open your filterscript and add
    Код:
    #include <geo_ip>
    just below #include <a_samp>
  4. Now you can use the function anywhere like this
    Код:
    new Country[16], State[128], City[128];
    isLocal=GetPlayerLocation(playerid,Country,State,City);
    OR
    Код:
    new Country[16], State[128], City[128];
    isLocal=GetPlayerLocation(playerid,Country,State,City,1);
    The third parameter is optional. It is isotype parameter. You will find more info about it below, in the FUNCTIONS section.
LITE
  • 1st step same as above.
  • Now open your filterscript and add
    Код:
    #include <geo_ip_lite>
    just below #include <a_samp>
  • Now you can use the function anywhere like this
    Код:
    new Country[16];
    isLocal=GetPlayerLocation(playerid,Country);
    OR
    Код:
    new Country[16];
    isLocal=GetPlayerLocation(playerid,Country,1);
    The third parameter is optional. It is isotype parameter. You will find more info about it below, in the FUNCTIONS section.

۞ FUNCTIONS
FULL
  • 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.
LITE
  • 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.
۞ DOWNLOADS
4Shared Links MegaCloud Links
۞ CHANGE LOG
  • 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)
۞ CREDITS
۞ 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.
Reply
#2

nice i was waiting for this and now you're update this :O
Reply
#3

Nice release, might use it in future

+repped
Reply
#4

damn it will be intersting but dat size of DB :P is big a.a for me atleast :X
anyways wb and thnx for another good release!
Reply
#5

Good job, if you could also upload it to something else, except 4Shared, then it'd be amazing!
Reply
#6

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Good job, if you could also upload it to something else, except 4Shared, then it'd be amazing!
Added MegaCloud Links ...
Reply
#7

Quote:
Originally Posted by abhinavdabral
Посмотреть сообщение
Added MegaCloud Links ...
Thanks a lot!

EDIT: I used the Lite and I joined from localhost, but this is what happened.
Quote:

[17:39:19] >>GEO-IP<< Dwane from has joined the server.

Reply
#8

Quote:
Originally Posted by Dwane
Посмотреть сообщение
Thanks a lot!
My pleasure
Reply
#9

You bought the whole location DB? Pro

Good to see one of SA-MP's useful includes updated!
Reply
#10

Quote:
Originally Posted by vMapper
Посмотреть сообщение
You bought the whole location DB? Pro

Good to see one of SA-MP's useful includes updated!
No, I just used the free one, and made some little alterations and conversions to it.

And, Thanks for appreciation.
Reply
#11

I used the filterscript you had on the package with this OnPlayerConnect
pawn Код:
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;
}
But everytime, it says this
Quote:

>>GEO-IP<< Dwane from has joined the server.

Reply
#12

Nice job man!
Reply
#13

Can you post a Pastebin link, since I am in my iPad? Thanks again in advance
Reply
#14

Awesome. <3

Can you make GetPlayerCountryCode ? Like "uk", "usa", "ro", "ru", "pl", "de" ... ?
Reply
#15

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
Reply
#16

Quote:
Originally Posted by Dwane
Посмотреть сообщение
I used the filterscript you had on the package with this OnPlayerConnect
pawn Код:
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;
}
But everytime, it says this
FIXED in 2.1. Sorry, my bad. It was because of the wrong name of database. Read the Change Log in the first page.

Quote:
Originally Posted by DJTunes
Посмотреть сообщение
Nice job man!
Thank You

Quote:
Originally Posted by vMapper
Посмотреть сообщение
Can you post a Pastebin link, since I am in my iPad? Thanks again in advance
What are you going to do with a pastebin link, when you still have to download the whole database ....

Quote:
Originally Posted by costel_nistor96
Посмотреть сообщение
Awesome. <3

Can you make GetPlayerCountryCode ? Like "uk", "usa", "ro", "ru", "pl", "de" ... ?
It already gives that by default. Output is like this. (EDIT: Released Version 2.1 : Now you can get output for the "Country[]" string, like - IN, IND, or INDIA - 2 letter, 3 letter, and full country name). This can be achieved by using the optional parameter isotype. Read the Change Log in the first page for more info.
Код:
>>GEO-IP<< CodeWave from (IN) Uttarakhand, Dehradun has joined the server
NOTE: In the above case (IN) is for INDIA.

Quote:
Originally Posted by AndreT
Посмотреть сообщение
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
I agree that plugins can do things pretty faster, but when my old C2D (E4300) can give location without taking not more than 10ms-30ms (I'm talking about FULL version of script that operates on a 114MB DB, not the LITE version) then I don't think the SERVERs are going to have any problems whatsoever regarding the speed of script.
Reply
#17

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?
Reply
#18

Quote:
Originally Posted by totar
Посмотреть сообщение
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?
If you are connection to some IP like (192.168.x.x) or something like that, It will show that. You MUST use the public IP of yours to resolve it to a real country name. To get your Public IP visit WhatIsMyIP.com.
If you are already using the Public IP to connect to your server, and still it shows that, then it means that the database record for your public IP Range is incorrect. In that case, you may use SQLite to fix it. (****** about it, if you don't know that, but please don't ask here).

I might add, this is now a script issue.

-Abhinav Dabral
(ALIAS: Code Wave | fb.me/CodeWave)
Reply
#19

Is there a way to get the player DNS using this include ?
Reply
#20

Quote:
Originally Posted by Vedo_
Посмотреть сообщение
Is there a way to get the player DNS using this include ?
Nope ...
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)