[Include] Anti-Cheat system v0.1
#1

Quote:
  • Changelog:
    • v0.1 released.
Introduction:
  • Hey guys. I decided to create this include for detect those common hacks that appear in SA-MP.
    I normally did not want to liberate it for personal reasons, but here it is!

Callbacks:
  • This include handles an single callback:
pawn Код:
public OnPlayerHackDetected(playerid, hacktype, oldvalue, newvalue)

/* - hacktype

CHEAT_WEAPON    0
CHEAT_MONEY     1
CHEAT_VEHMOD    2
CHEAT_******    3 // s0b3it.

*/

Functions:
  • It did not have thought to add functions, but well. Maybe this could help a bit with the information of the player:
pawn Код:
native SetPlayerReliable(playerid, bool:reliable); // We can establish that a player is reliable (As a NPC or an admin).
native SetSuspectToPlayer(playerid, bool:suspect); // Or no... (PS: the same include will add values to these functions).

native IsPlayerReliable(playerid);
native IsPlayerSuspect(playerid);
native GetPlayerWarnings(playerid); // This will return the quantity of warnings of "possible cheat" that the have player.


Example:
  • Here a few explanations of the include:
pawn Код:
#include <Anti_Cheat>
#include <YSI\y_iterate>


public OnPlayerConnect(playerid)
{
    if(IsPlayerNPC(playerid)) SetPlayerReliable(playerid, true);
    else SetPlayerReliable(playerid, false);
    return 1;
}


public OnPlayerCheatDetected(playerid, cheattype, oldvalue, newvalue)
{
    if(GetPlayerWarnings(playerid) == 5) return SendClientMessage(playerid, -1, "* Good-bye."), Ban(playerid);

    switch(cheattype)
    {
        case CHEAT_WEAPON:
        {
            SendClientMessage(playerid, 0xFF0000AA, "* Hey, here not!");
            GivePlayerWeapon(playerid, oldvalue, 10); // Give original weapon.
        }
        case CHEAT_MONEY:
        {
            new string[128];
            new Nick[MAX_PLAYER_NAME];

            GetPlayerName(playerid, Nick, sizeof(Nick));
            format(string, sizeof(string), "* %s[%d] Possible Money-Hack - [$%i -> $%i = +$%i].", Nick, playerid, oldvalue, newvalue, (newvalue-oldvalue));
            foreach(new i: Player)
            {
                if(IsPlayerAdmin(i)) SendClientMessage(i, -1, string);
            }
        }
    }
    return 1;
}


Notes:
  • You will have to mark to these players as "suspects" (except if it treats of HACK_VEHMOD) before of to prohibit or to expel them, їwhy?
    • Money: A player can gain money doing the unique acrobatics.
      Weapons: A player can buy weapon in a shop.
      And others stuff...


Future versions:
  • - Anti Aim-Bot and GodMode.
  • - Fix at %100 'HACK_WEAPON'.


Download:


Credits:
  • EnzoMetlc - Idea and code.
    pds2k12/Patrick_ - Some chats entertaining on Skype.


If you have ideas or suggestions, don't hesitate in say me!
- Regards.
Reply
#2

im waiting for anti-bot and godmode and add anti bunny hop
Reply
#3

Oh thank you, I'll bear it in mind
Reply
#4

works ?
Reply


Forum Jump:


Users browsing this thread: 2 Guest(s)