SA-MP Forums

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

Reply
 
Thread Tools Display Modes
Old 10/11/2011, 07:56 AM   #1
Whitetiger
Huge Clucker
 
Whitetiger's Avatar
 
Join Date: Nov 2007
Posts: 406
Reputation: 156
Default GeoIP v2.0 (ISP, Country, City) - With updated Databases!

GeoIP (ISP, Country, City)


I have been working on a geo IP that doesn't require a plugin and that can detect more than country, at a fast speed that doesn't freeze the server. The result is this.

The INC uses SQLite this product includes GeoLite data created by MaxMind, available from
http://maxmind.com/

http://geolite.maxmind.com/download/...se/LICENSE.txt

The Country and ISP database is 15 MB, the City database alone is 100 MB, City is in a seperate SQLite database incase you decide not to upload city. (compressed, both databases together are 40 mb)

Speed test


Code:
[07:54:06] took 1 ms - GetPlayerCountry
[07:54:06] took 0 ms - GetPlayerCity
[07:54:06] took 17 ms - GetPlayerISP
If you are an SQL guru and can understand how the include works and have a faster solution to get the info even faster, please post or pm me. The point of this include is a quick SQL query that hang pause the server!

Functions

Code:
GetPlayerCountry(playerid, string[], const len = sizeof(string));
GetPlayerISP(playerid, string[], const len = sizeof(string));
GetPlayerCity(playerid, string[], const len = sizeof(string));
GetPlayerGMT(playerid);

GetIPCountry(ip[], dest[], len = sizeof(dest));
GetIPISP(ip[], dest[], len = sizeof(dest));
GetIPCity(ip[], dest[], len = sizeof(dest));
GetIPGMT(ip[]);
If you want to edit the functions or add to them looking at the databases, you can actually get thing such as Area code, Metro code, Region, Postal code, city latitude and city longitude.

Accuracy


http://www.maxmind.com/en/city_accuracy - City accuracy
Country accuracy - 99.5%

Updates


I will try to update the database files monthly when Maxmind updates their databases on their website

Download


GitHub
Download (Database files) (place in /scriptfiles/)
Example

New include will not work with old database files! you must update the database files AND the include for it to work!

Credits

- Whitetiger
- RaekwonDaChef
- ******
- Andreas Gohr

Last edited by Whitetiger; 02/04/2016 at 03:36 PM.
Whitetiger is offline   Reply With Quote
Old 10/11/2011, 07:58 AM   #2
[ABK]Antonio
High-roller
 
[ABK]Antonio's Avatar
 
Join Date: Sep 2011
Location: ID, USA
Posts: 1,223
Reputation: 185
Default Re: GeoIP (ISP, Country, City)

Nice post White
__________________

ABKClan.com
[ABK]Antonio is offline   Reply With Quote
Old 10/11/2011, 08:09 AM   #3
Lorenc_
High-roller
 
Lorenc_'s Avatar
 
Join Date: Jan 2010
Location: Australia
Posts: 3,793
Reputation: 1179
Default Re: GeoIP (ISP, Country, City)

Nice include! Will be pretty useful for country banning :3
__________________
Join the best Cops And Robbers in SA-MP, today. svr.sfcnr.com:7777

Lorenc_ is offline   Reply With Quote
Old 10/11/2011, 08:39 AM   #4
CrunkBankS
Huge Clucker
 
CrunkBankS's Avatar
 
Join Date: Feb 2009
Location: Novorossiysk
Posts: 471
Reputation: 9
Default Re: GeoIP (ISP, Country, City)

You a have database GeoIP for MySQL? or how to convert
__________________

Music Producer

CrunkBankS is offline   Reply With Quote
Old 10/11/2011, 08:42 AM   #5
Whitetiger
Huge Clucker
 
Whitetiger's Avatar
 
Join Date: Nov 2007
Posts: 406
Reputation: 156
Default Re: GeoIP (ISP, Country, City)

i wrote it originally in mysql but but it caused some problems with phpmyadmin and i figured most server hosts wouldnt allow you to import 275 MB of sql information (at least, everyone i tried wouldnt let me import even 100 mb!), so its SQLite to save people time from importing large files into their databases, and the queries where slower and would freeze the server when it was doing the look up even with threaded queries
__________________
GitHub

Author of SA-MP AC

Whitetiger is offline   Reply With Quote
Old 10/11/2011, 08:48 AM   #6
CrunkBankS
Huge Clucker
 
CrunkBankS's Avatar
 
Join Date: Feb 2009
Location: Novorossiysk
Posts: 471
Reputation: 9
Default Re: GeoIP (ISP, Country, City)

Quote:
Originally Posted by whitetigerswt View Post
where slower and would freeze the server when it was doing the look up even with threaded queries
Freeze SA:MP or MySQL server?
__________________

Music Producer

CrunkBankS is offline   Reply With Quote
Old 10/11/2011, 08:50 AM   #7
Whitetiger
Huge Clucker
 
Whitetiger's Avatar
 
Join Date: Nov 2007
Posts: 406
Reputation: 156
Default Re: GeoIP (ISP, Country, City)

the sa-mp server would freeze
__________________
GitHub

Author of SA-MP AC

Whitetiger is offline   Reply With Quote
Old 10/11/2011, 06:48 PM   #8
JazZ09uN
Little Clucker
 
Join Date: Oct 2011
Posts: 3
Reputation: 0
Default Respuesta: GeoIP (ISP, Country, City)

Nice post man Really
JazZ09uN is offline   Reply With Quote
Old 10/11/2011, 07:07 PM   #9
Norn
High-roller
 
Norn's Avatar
 
Join Date: Jul 2008
Location: Northern Ireland
Posts: 2,265
Reputation: 206
Default Re: GeoIP (ISP, Country, City)

Very nice script!

Quote:
Originally Posted by CrunkBankS View Post
Freeze SA:MP or MySQL server?
The other filterscript that's released is poorly coded and hangs the server if it doesn't find the result.
__________________
Pursuing other endeavours.

Skype: datinvictusguy
Norn is offline   Reply With Quote
Old 10/11/2011, 07:10 PM   #10
Slice
High-roller
 
Join Date: Mar 2008
Posts: 1,831
Reputation: 1607
Default Re: GeoIP (ISP, Country, City)

Quote:
Originally Posted by Norn View Post
Very nice script!



The other filterscript that's released is poorly coded and hangs the server if it doesn't find the result.
I hope you're not referring to mine.
Slice 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


Similar Threads
Thread Thread Starter Forum Replies Last Post
[Plugin] GeoIP Plugin v0.1.4 (Country detector) - 04/05/2008 Totto8492 Plugin Development 220 03/05/2017 07:14 AM
Favorite Country Side City? Darklom Everything and Nothing 15 22/03/2011 01:18 AM
[FilterScript] [FS] Short and simple teleport dialog from country to country bartje01 Filterscripts 2 18/03/2010 01:31 PM


All times are GMT. The time now is 02:28 PM.


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