[Tutorial] Easy Anti-Health hack.
#1

INTRODUCTION



Alright, so, basically, today i will show you how to script an Easy Anti-Health hack, which works pretty well.
It is also used in my game-mode.



---------------------------------------------------------------------------------------------------------------------
REQUIREMENTS



You will need this plugin:
Y_INI -> https://sampforum.blast.hk/showthread.php?tid=175565


---------------------------------------------------------------------------------------------------------------------
SCRIPTING



Alright, let's get started!

#1:

After you've added the Y_INI plugin, add this to the enum:
pawn Code:
enum pInfo
{
    //other stuff
    pAdmin,
    pACDetected
}
Then, you add this at "OnPlayerDisconnect"

pawn Code:
new INI:File = INI_Open(UserPath(playerid));
    INI_SetTag(File,"data");
    //other stuff here
    INI_WriteInt(File,"Admin",PlayerInfo[playerid][pAdmin]);
    INI_WriteInt(File,"ACDetected",PlayerInfo[playerid][pACDetected]);
    INI_Close(File);
And finally, at "Loaduser_data", add

pawn Code:
forward LoadUser_data(playerid,name[],value[]);
public LoadUser_data(playerid,name[],value[])
{
    //other stuff here
    INI_Int("Admin",PlayerInfo[playerid][pAdmin]);
    //other stuff here
    INI_Int("ACDetected",PlayerInfo[playerid][pACDetected]);
    return 1;
}
That's about it i suppose.

----

#2:

Find the "OnPlayerTakeDamage" call-back, we will script it in there.

For you, it will probably look like this(At the start):

pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    return 1;
}
Alright, now add this:
pawn Code:
if(PlayerInfo[playerid][pAdmin] == 0) //if he isn't an admin
                        {
It basically checks if the player is NOT an admin, so it looks like
pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(PlayerInfo[playerid][pAdmin] == 0) //if he isn't an admin
    {
        //script will be here
    }
    return 1;
}
Alright, now we will add this:

pawn Code:
if(PlayerInfo[playerid][pACDetected] == 0) //Y_INI enum, if the player hasn't been detected by the anti-cheat
    {
Under that;

pawn Code:
new Float:armour;
GetPlayerArmour(playerid, armour);
That will get the players(Possible hackers) armour.

For now, it looks like this:

pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(PlayerInfo[playerid][pAdmin] == 0) //if he isn't an admin
    {
        if(PlayerInfo[playerid][pACDetected] == 0) //Y_INI enum, if the player hasn't been detected by the anti-cheat
        {
            new Float:armour;
            GetPlayerArmour(playerid, armour);
        }
    }
    return 1;
}
Now, we will add this line, under "GetPlayerArmour(....);"

pawn Code:
if(armour == 0) //if his armour is 0
                {
As the comment says, it checks if the players(hackers) armour is 0!

Under the if(armour == 0), we will add these lines:

pawn Code:
new string[94];
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new Float:health;
GetPlayerHealth(playerid,health);
new string: We will need this to format a message to the admins
new name: We will get the players(hackers) name, so we can add it in the string, and so admins know WHO is actually hacking.
new Float:health, and the line below it: Will get the players(hackers) health.

So, for now, it should look something like this:
pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(PlayerInfo[playerid][pAdmin] == 0) //if he isn't an admin
    {
        if(PlayerInfo[playerid][pACDetected] == 0) //Y_INI enum, if the player hasn't been detected by the anti-cheat
        {
            new Float:armour;
            GetPlayerArmour(playerid, armour);
            if(armour == 0) //if his armour is 0
            {
                new string[94]; //String for a message
                new name[MAX_PLAYER_NAME]; //Gets the hackers(players) name
                GetPlayerName(playerid, name, sizeof(name));
                new Float:health; //Gets the hackers(players) health
                GetPlayerHealth(playerid,health);
            }
        }
    }
    return 1;
}
Alright, now we need to do this:
pawn Code:
if(health >= 99) //If his health is 99 or more
{
    format(string, sizeof(string), "[ANTI-CHEAT] - %s[%d] is POSSIBLY using Health-Hacks!", name, playerid);
    SendMessageToAdmins(COLOR_ORANGE, string); //Sends the message to admins
    PlayerInfo[playerid][pACDetected] = 1; //Sets him as "Detected by Anti-Cheat", also avoids spam!
}
So, basically, if his ARMOUR is 0, and after all those shots, his health is 99 or more, then the ADMINS get warned.

Here's the FULL script:

pawn Code:
public OnPlayerTakeDamage(playerid, issuerid, Float: amount, weaponid)
{
    if(PlayerInfo[playerid][pAdmin] == 0) //if he isn't an admin
    {
        if(PlayerInfo[playerid][pACDetected] == 0) //Y_INI enum, if the player hasn't been detected by the anti-cheat
        {
            new Float:armour;
            GetPlayerArmour(playerid, armour);
            if(armour == 0) //if his armour is 0
            {
                new string[94]; //String for a message
                new name[MAX_PLAYER_NAME]; //Gets the hackers(players) name
                GetPlayerName(playerid, name, sizeof(name));
                new Float:health; //Gets the hackers(players) health
                GetPlayerHealth(playerid,health);
                if(health >= 99) //If his health is 99 or more
                {
                    format(string, sizeof(string), "[ANTI-CHEAT] - %s[%d] is POSSIBLY using Health-Hacks!", name, playerid);
                    SendMessageToAdmins(COLOR_ORANGE, string); //Sends the message to admins
                    PlayerInfo[playerid][pACDetected] = 1; //Sets him as "Detected by Anti-Cheat", also avoids spam!
                    return 1;      
                }
            }
        }
    }
    return 1;
}
----------

#3:

And to finish it, we need the "SendMessageToAdmins", and here it is:

pawn Code:
stock SendMessageToAdmins(color, text[])
{
    for(new i = 0; i < MAX_PLAYERS; i++) //loops trough all the players
    {
        if(PlayerInfo[i][pAdmin] >= 1) //if his(their) level 1 or more
        {
            SendClientMessage(i, color, text); //he(they) receive(s) the message
        }
    }
}
I've tested this 3 - 4x, and It worked 99%.
Reply


Messages In This Thread
Easy Anti-Health hack. - by Kyance - 19.01.2014, 12:22
Re: Easy Anti-Health hack. - by JeromeG - 19.01.2014, 12:37
Re: Easy Anti-Health hack. - by Pottus - 19.01.2014, 12:39
Re: Easy Anti-Health hack. - by Omar55555 - 19.01.2014, 12:56
Re: Easy Anti-Health hack. - by Kyance - 19.01.2014, 13:03
Re: Easy Anti-Health hack. - by Lordzy - 19.01.2014, 13:03
Re: Easy Anti-Health hack. - by Kyance - 19.01.2014, 13:08
Re: Easy Anti-Health hack. - by Patrick - 19.01.2014, 13:25
Re: Easy Anti-Health hack. - by Cypress - 19.01.2014, 15:37
Re: Easy Anti-Health hack. - by Hoborific - 23.01.2014, 02:46

Forum Jump:


Users browsing this thread: 1 Guest(s)