[FilterScript] GEO-IP (GeoIp) v3 : Faster & Flexible
#1



[October 25, 2015] UPDATED!
(DB + New Server)
» PRE-REQUISITES
  • Brain
  • Capability of not asking stupid questions
  • Knowledge of Scripting in SA-MP (or at least copy pasting carefully)
» STATUS
  • GEO-IP WEB SERVER (if you don't see a green light, server is offline):
  • Last DB UPDATE : March 30th, 2015
  • Bugs : NONE!
  • IPv4 Support : Yes!
  • IPv6 Support : NO!
  • Accuracy : Using free City Database from db-ip.com, go figure.

» WHAT IS IT

I've updated this years old thread as it got some attention randomly. I guess it was buried somewhere and missed some love it deserved. So, even after this project was closed years ago, I resurrected it (sort of) and now you can just simply use the script and don't need to worry about a single thing.

Also, I was sitting, settip up the whole thing for straight 4 hours (out of which, for 2 hours, I was staring at the longest SQL query running of my life), so please be gentle and keep any negative comments to yourself about something that you're getting done for free. If you're not so happy with my server's response, setup your own (tutorial attached).


» WHY?
  • Fast (Literally) Feel free to compare it to others in terms of speed
  • Doesn't requires SQLite or anything, just simple HTTP Request
  • (As of March 30th, 2015) I've setup a free (for you all, I actually paid for it) server for this.
  • Copy n Run, no customization needed to make this work. (However, you can customize format strings and customize the output in your own way
  • Tutorial is attached in Attachment Section if you want to setup your own GEO-IP web service.
  • Now you can rant about accuracy, but hey, I'm using free database, if you've for some premium database, feel free to use on your own server (Tutorial attached)
» HOW TO USE / SA-MP PAWN CODE

This is way more simpler than you can imagine. Seriously, I mean it now ... Just do as I say and you'll have GEO-IP Ready and running on your server in no time.

STEP 1
Add this line on the top of your FS/GM (if it's not already there for some reason)
PHP код:
#include <a_http> /// <- Add this include, it's needed to HTTP() function. 
STEP 2
Now add this callback along with all other callbacks :
(feel free to customize format strings and if you are Pawno wizard, customize it even further)

PHP код:
forward GEOIP_HTTPREQUEST(playeridresponse_codelocation[]);
public 
GEOIP_HTTPREQUEST(playeridresponse_codelocation[]) // The GEO-IP Callback.
{
    new 
string[128];
    if(
response_code == 200) {
        new 
Pname[64];
        
GetPlayerName(playerid,Pname,sizeof(Pname));
        
format(stringsizeof(string), ">> %s joined the server from %s",Pname,location);
        
SendClientMessage(playerid0x00CCFFFFstring);
        return 
1;
    }
    else {
        
format(stringsizeof(string), "%d : Request Failed"response_code);
        
SendClientMessage(playerid0xCC9900FFstring);
        return 
0;
    }

STEP 3
Lastly, search for your OnPlayerConnect Callback on your FS/GM and update it. As I mentioned above, you should know a little scripting to see what's going on in here.

PHP код:
public OnPlayerConnect(playerid// Your OnPlayerConnect Callback.
{
    new 
req[256];
    new 
IP[16];
        
GetPlayerIp(playerid,IP,sizeof(IP));
    
// format(IP,sizeof(IP),"117.56.0.98"); //Un-comment this line if you want to put some random Dummy IP to test the script
    
if(strlen(IP)<1) return 1;
    
format(reqsizeof(req),"geoip.cybernieve.com/?IP=%s",IP); //// Replace the address (geoip.cybernieve.com) if you've setup your own GEO-IP Server
    
HTTP(playeridHTTP_GETreq,"","GEOIP_HTTPREQUEST");
    return 
1;


» TUTORIAL (only if you want your own GEP-IP Web Server)


See Attachment section


» SUPPORT AND LICENSE

This is a free thing. Use it, modify it, But don't sell it by your name OR even my name on it. Keep it free. Maybe develop it further (find ways to make it faster, maybe?). If you do that, don't forget to mention my name for the BASE set-up, or the idea, whatever. It's not something NEW, but for me, it definitely is an achievement.

Comments are welcomed. REP++ me if you find this thing helpful. But, I don't think I'm going to work more on this.


» CREDITS

Me (Abhinav Dabral [CODE Wave]) for the whole thing | fb.me/CodeWave
Database : db-ip.com

-X-X-X-X--- (Update : March 30, 2015) This Project will remain closed as I think it's perfect now (as a base). If someone wants to mix in their own ideas, they are free to do so. As for this one, script is working, everything is working. I've setup new server so that's also working. I'll update the IP Database, someday maybe if needed but otherwise there is nothing more to this. Read the attached documentation if you want to setup your own server. ---X-X-X-X-
Reply
#2

I think i will use this geopip again xD
Reply
#3

Good Work, Upload those files will get evaded with this, Good idea.
Reply
#4

Awesome Work buddy
Reply
#5

awesome
Reply
#6

Lawl, this is really very good version of Geo IP. I'll use it, and i think i will use this version, not others what use databases.
Reply
#7

Well done.
Reply
#8

Awesome !
Reply
#9

Код:
C:\Users\yessica\Desktop\Carpetas\WEAPON_SCROLL_MOD_2_0_BETA\Gran-Destruccion 2.0\filterscripts\ladmin.pwn(1235) : error 017: undefined symbol "HTTP"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Reply
#10

Quote:
Originally Posted by Matyaas
Посмотреть сообщение
Код:
C:\Users\yessica\Desktop\Carpetas\WEAPON_SCROLL_MOD_2_0_BETA\Gran-Destruccion 2.0\filterscripts\ladmin.pwn(1235) : error 017: undefined symbol "HTTP"
Pawn compiler 3.2.3664	 	 	Copyright © 1997-2006, ITB CompuPhase


1 Error.
Seriously dude ? Are you kidding me ? .....

Add the "a_http" library. *Facepalm*

Код:
#include <a_http>
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)