20.05.2012, 08:59
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];
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
Don't also forget to add
pawn Код:
JetPack[playerid] = 0; //Setting our Global Variable JetPack to 0 when OnPlayerConnect/Disconnect Called
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;
}
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;
}
Good Luck building your Anti-Jetpack Hack!