SA-MP Forums Archive
It IS posible? - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: It IS posible? (/showthread.php?tid=664846)



It IS posible? - nbx2000 - 13.03.2019

It is possible to activate and deactivate with this command rcon modifying this anti-vpn fs
#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


Re: It IS posible? - L0K3D - 13.03.2019

You can load, unload, reload a FS using rcon commands.


Re: It IS posible? - nbx2000 - 13.03.2019

how?If you can create an active cmd and deactivate the anti proxy?


Re: It IS posible? - TokicMajstor - 13.03.2019

Make the cmd in main gamemode:
Код:
YCMD:turnoffantivpn(playerid, params[])
{
    if(!IsPlayerAdmin) return SendClientMessage(playerid, -1, "You are not Admin silly boy");
    SendRconCommand("loadfs %YourFSName%");
    return 1;
}
YCMD:turnonantivpn(playerid, params[])
{
    if(!IsPlayerAdmin) return SendClientMessage(playerid, -1, "You are not Admin silly boy");
    SendRconCommand("unloadfs %YourFSName%");
    return 1;
}



Re: It IS posible? - SymonClash - 13.03.2019

pawn Код:
new bool: AntiVPNLoaded;

YCMD:antivpn(playerid, params[])
{
    if(!IsPlayerAdmin) return SendClientMessage(playerid, -1, "You are not an admin.");

    switch(AntiVPNLoaded)
    {
        case false: //Anti VPN NOT loaded, let's load it...
        {
            SendRconCommand("loadfs %YourFSName%");
            SendClientMessage(playerid, -1, "Anti VPN filterscript loaded.");
        }
       
        case true: //Anti VPN loaded, let's unload it...
        {
            SendRconCommand("unloadfs %YourFSName%");
            SendClientMessage(playerid, -1, "Anti VPN filterscript unloaded.");
        }
    }
    return 1;
}

public OnPlayerConnect(playerid)
{
    if(AntiVPNLoaded == true) //Anti VPN is loaded, let's do the proxy check...
    {
        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;
}
Then, if you wish to auto activate it on server start, just put:

pawn Код:
AntiVPNLoaded = true;
on OnGameModeInit.