[Tutorial] Detecting if player is Jetpack Hacking
#1

Anti-Jetpack Hack (Global Variable)

Tutorial Made by Romel
_________________________________

Tired seeing Hacker that use Jetpack hack around your server?
Tired banning them? This tutorial will teach you how to detect Jetpack Hack
that doesn't banned innocent people. 99% anticheat working!

Starting:

Open your script or open pawn.exe click new.

Now we are ready to start.

add this below the #includes

pawn Код:
new JetPack[MAX_PLAYERS];
This is Global Variable. we will use this for checking Jetpack Hack
i will tell you how to do it later.

now to avoid detecting that innocent people is using Jetpack Hack we need to add

pawn Код:
JetPack[playerid] = 1; //Setting our Global Variable JetPack to 1
in our command, Because later we will check if JetPack Global Variable is 0

Don't also forget to add

pawn Код:
JetPack[playerid] = 0; //Setting our Global Variable JetPack to 0 when OnPlayerConnect/Disconnect Called
OnPlayerConnect/Disconnect

now here is example of command JetPack in strcmp (This command will not detect as Hack)

pawn Код:
if(strcmp(cmdtext, "/jetpack", true) == 0)
{
     if(JetPack[playerid] == 1) return SendClientMessage(playerid, -1, "Already have jetpack!"); //if the global variable JetPack is already 1, SendClientMessage will called and will send to the player who use the command, Remember -1 means COLOR_WHITE, some users say -1 is invalid color, they aren't.
     JetPack[playerid] = 1; //Keep in mind set global variable JetPack to 1 before setting player special action to SPECIAL_ACTION_USEJETPACK to avoid the hack detection
     SetPlayerSpecialAction(playerid, SPECIAL_ACTION_USEJETPACK); //will make player use jetpack
     return 1;
}
i don't use strcmp but i think the code i mention above will work. try it yourself

Now its time to code our Anti-Jetpack Hack detection!

pawn Код:
public OnPlayerUpdate(playerid)
{
    if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK) //will check if player is using Jetpack
    {
        if(JetPack[playerid] == 0) //if global variable JetPack is 0
        {
             //Your ban/kick/warn code here!
        }
        else //if global variable JetPack is 1
            return 1; //will return 1;
    }
    else JetPack[playerid] = 0; //if player leaves the JetPack using Enter/F it will set the Global Variable JetPack to 0 again to avoid the problem in our command /jetpack
    return 1;
}
It might be n00b for long time scripters but this is for beginners.

Good Luck building your Anti-Jetpack Hack!
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)