Anti-Cheat
#1

I make an anticheat and can you tell me which one will not work?
I compile it without error.
My GTASA infected by virus thats why I ask


define:
pawn Код:
#define USE_ANTI_WEAPON    true
#define USE_ANTI_HEALTH    true
#define USE_ANTI_ARMOUR    true
#define USE_ANTI_JETPACK   true
#define USE_ANTI_PING      true
#define USE_ANTI_VEHICLE   true
#define USE_ANTI_SPAM      true
#define USE_ANTI_MONEY     true
#define USE_ANTI_ADS       true
#define MAX_MONEY          999999999
#define MAX_HEALTH         100
#define MAX_ARMOUR         100
#define MAX_PING           1000
#define MAX_ENTER_VEHICLE  3
#define MAX_SPAM_MSGS      5


#define CHECK_WEAPS         GetPlayerWeapon(playerid)
#define CHECK_MONEY         GetPlayerMoney(playerid)
#define CHECK_NAME          GetPlayerName(playerid)
#define CHECK_HEALTH(%0,%1) GetPlayerHealth(%0, %1)
#define CHECK_ARMOUR(%0,%1) GetPlayerArmour(%0,%1)
pawn Код:
public OnPlayerUpdate(playerid)
{
   #if USE_ANTI_WEAPON == true
   if(CHECK_WEAPS == 35 || CHECK_WEAPS == 36 || CHECK_WEAPS == 38)
   GetPlayerName(playerid, pName,sizeof (pName));
   format(string,sizeof(string),"* %s has been kick * Reason : Weapon Hack Detected !",pName);
   SendClientMessageToAll(RED,string);
   Kick(playerid);
   #endif
   #if USE_ANTI_MONEY == true
   if(CHECK_MONEY >= MAX_MONEY)
   GetPlayerName(playerid,pName, sizeof(pName));
   format(string, sizeof(string), "* %s money has been resetted * Reason : Money Hack Detected !", pName);
   SendClientMessageToAll(RED, string);
   ResetPlayerMoney(playerid);
   #endif
   #if USE_ANTI_HEALTH == true
   new Float:Health;
   if(CHECK_HEALTH(playerid, Health) >= MAX_HEALTH)
   GetPlayerName(playerid, pName, sizeof(pName));
   format(string, sizeof(string), "* %s has been kicked * Reason : Health Hack Detected !", pName);
   SendClientMessageToAll(RED, string);
   Kick(playerid);
   #endif
   #if USE_ANTI_ARMOUR == true
   new Float:Armour;
   if(CHECK_ARMOUR(playerid, Armour) >= MAX_ARMOUR)
   GetPlayerName(playerid, pName, sizeof(pName));
   format(string, sizeof(string), "* %s has been kicked * Reason : Armour Hack Detected !", pName);
   SendClientMessageToAll(RED, string);
   Kick(playerid);
   #endif
   #if USE_ANTI_PING == true
   if(GetPlayerPing(playerid) >= MAX_PING)
   GetPlayerName(playerid, pName, sizeof(pName));
   format(string, sizeof(string), "* %s has been kicked * Reason : High Ping Over "#MAX_PING" !", pName);
   SendClientMessageToAll(RED, string);
   SendClientMessage(playerid, RED,"* You has been kicked * Reason : High Ping Over "#MAX_PING" !");
   Kick(playerid);
   #endif
   #if USE_ANTI_JETPACK == true
   if(GetPlayerSpecialAction(playerid) == SPECIAL_ACTION_USEJETPACK)
   GetPlayerName(playerid, pName, sizeof(pName));
   format(string, sizeof(string), "* %s has been kicked * Reason : Jetpack Hack Detected !", pName);
   SendClientMessageToAll(RED, string);
   Kick(playerid);
   #endif
   return 1;
}

public OnPlayerStateChange(playerid, newstate, oldstate)
{
    #if USE_ANTI_VEHICLE == true
    if(IsPlayerInAnyVehicle(playerid) || newstate == PLAYER_STATE_DRIVER || newstate == PLAYER_STATE_PASSENGER)
    pVehicles[playerid]++;
    if(pVehicles[playerid] >= MAX_ENTER_VEHICLE)
    format(string, sizeof(string), "* %s has been kicked * Reason : Vehicle Hack Detected !.");
    SendClientMessageToAll(RED, string);
    Kick(playerid);
    #endif
    return 1;
}

public OnPlayerText(playerid, text[])
{
    #if USE_ANTI_SPAM == true
    pLineCount[playerid]++;
    if(pLineCount[playerid] >= MAX_SPAM_MSGS)
    pMuted[playerid] = true;
    SetTimerEx("Unmute", 30000, 0, "i", playerid);
    #endif
    #if USE_ANTI_ADS == true
    new
        is1 = 0,
        r = 0,
        strR[255];

    while(strlen(text[is1]))
    {
        if('0' <= text[is1] <= '9')
        {
            new is2 = is1 + 1, p=0;

            while(p == 0)
            {
                if('0' <= text[is2] <= '9' && strlen(text[is2]))
                {
                   is2++;
                }
                else
                {
                    strmid(strR[r], text, is1, is2, sizeof(strR));
                    if(strval(strR[r]) < sizeof(strR)) r++;
                    is1 = is2;
                    p = 1;
                }
            }
        }
        is1++;
    }
    if(r >= 4)
    {
        SendClientMessage(playerid, RED, "Advertising is not allowed");
        return 0;
    }
    #endif

    return 1;
}
Reply
#2

All of them won't work. Your if checks needs to have braces.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)