Skip to content

Instantly share code, notes, and snippets.

@GnikLlort
Last active May 11, 2022 17:08
Show Gist options
  • Save GnikLlort/751b22c67228016ce9ca5c2c758d073e to your computer and use it in GitHub Desktop.
Save GnikLlort/751b22c67228016ce9ca5c2c758d073e to your computer and use it in GitHub Desktop.
Grand theft auto San Andreas multiplayer Filterscript that blocks anyone from joining the server with a proxy or VPN!
I had the problem of a cunt rejoining my server with a new ip just after I ban it, so I scraped this togeter and it works pretty dank.
V1.2 UPDATE
Will no longer kick anyone connecting from localhost (127.0.0.1)
// This is a comment
// uncomment the line below if you want to write a filterscript
#define FILTERSCRIPT
#include <a_samp>
#include <a_http>
#if defined FILTERSCRIPT
public OnFilterScriptInit()
{
print("\n--------------------------------------");
print(" Anti Proxy by Gnikllort ");
print("--------------------------------------\n");
return 1;
}
public OnFilterScriptExit()
{
return 1;
}
forward MyHttpResponse(playerid, response_code, data[]);
public OnPlayerConnect(playerid)
{
new ip[16], string[59];
GetPlayerIp(playerid, ip, sizeof ip);
format(string, sizeof string, "www.shroomery.org/ythan/proxycheck.php?ip=%s", ip);
HTTP(playerid, HTTP_GET, string, "", "MyHttpResponse");
return 1;
}
public MyHttpResponse(playerid, response_code, data[])
{
new name[MAX_PLAYERS],string[256];
new ip[16];
GetPlayerName(playerid, name, sizeof(name));
GetPlayerIp(playerid, ip, sizeof ip);
if(strcmp(ip, "127.0.0.1", true) == 0)
{
format(string, 256, "[LOCALHOST] %s(%d) has joined the server.", name, playerid);
SendClientMessageToAll( 0x09F7DFC8, string);
return 1;
}
if(response_code == 200)
{
if(data[0] == 'Y')
{
format(string, 256, "[PROXY DETECTED] %s(%d) has been kicked from the server.", name, playerid);
SendClientMessageToAll( 0xFF0000FF, string);
SendClientMessage(playerid, 0xFF0000FF, "_________Please disable your proxy/VPN and rejoin!_________");
SetTimerEx("DelayedKick", 100, false, "i", playerid);
}
if(data[0] == 'N')
{
format(string, 256, "[PROXY NOT DETECTED] %s(%d) thank you for joining!", name, playerid);
SendClientMessageToAll( 0x09F7DFC8, string );
}
if(data[0] == 'X')
{
printf("WRONG IP FORMAT");
}
else
{
printf("The request failed! The response code was: %d", response_code);
}
}
return 1;
}
forward DelayedKick(playerid);
public DelayedKick(playerid)
{
Kick(playerid);
return 1;
}
#endif
@GnikLlort
Copy link
Author

Little something I made to stop some script kiddies from joining my server when they where banned.

@Bios-Marcel
Copy link

Seems cool overall, anyways, you might want to check if you can get a proxy list that is local and will be updated once you start the server or issue a command, otherwise you are creating unecessary traffic and overhead :P

@GnikLlort
Copy link
Author

Problem is creating that proxy list will also create unnecessary traffic and overhead and could get you banned from your host if your scanner/scraper is running for to long, this is the best way.

@errkedukke
Copy link

having an issue, status code in response is always 1 despite anything. What up with that?

@thangminh999
Copy link

not working !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment