Anticheat Efficiency
#1

So far my anticheat I did was working pretty good from what I saw. When someone gets banned it should come out like this: BANNED: CHEATER has been auto banned by console.

Well a about 3 times it came out like this:


BANNED: CHEATER has been auto banned by console.
BANNED: has been auto banned by console.
BANNED: has been auto banned by console.
BANNED: has been auto banned by console.
BANNED: has been auto banned by console.

So something here is obviously not working correctly at some times. Is there any better way to do my anticheat then the way I have it set up then it is now. There code is:

pawn Код:
#include <a_samp>
#include <IsPlayerLadmin>

new timer;
new bool: ADMIN[MAX_PLAYERS];
new bool: ADMIN2[MAX_PLAYERS];
new bool: ADMIN3[MAX_PLAYERS];
new bool: ADMIN4[MAX_PLAYERS];
new bool: ADMIN5[MAX_PLAYERS];
new bool: ADMIN6[MAX_PLAYERS];

public OnFilterScriptInit()
{
  timer = SetTimer("AntiCheat",5000,true);
    print(" Cheat Extinguisher by [SU]BP13 loaded");
    return 1;
}

public OnFilterScriptExit()
{
    KillTimer(timer);
    return 1;
}

public OnPlayerRequestSpawn(playerid)
{
    if(IsPlayerLAdmin(playerid))
    {
    ADMIN[playerid] = true;
    ADMIN2[playerid] = true;
    ADMIN3[playerid] = true;
    ADMIN4[playerid] = true;
    ADMIN5[playerid] = true;
    ADMIN6[playerid] = true;
    }
    return 1;
}

public OnPlayerDisconnect(playerid)
{
  ADMIN[playerid] = false;
  ADMIN2[playerid] = false;
  ADMIN3[playerid] = false;
  ADMIN4[playerid] = false;
  ADMIN5[playerid] = false;
  ADMIN6[playerid] = false;
  return 1;
}

forward AntiCheat();
public AntiCheat()
{
    new weap, ammo;
    for(new i = 0; i < MAX_PLAYERS; i++)
    {
      if(ADMIN[i] == false)
      {
            GetPlayerWeaponData(i, 9, weap, ammo);
            if(weap == 42)
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
                SendClientMessageToAll(0xFF0000FF, string);
                BanEx(i, "AntiCheat - Fire Extinguisher");
            }
        }
        if(ADMIN2[i] == false)
      {
            GetPlayerWeaponData(i, 10, weap, ammo);
            if(weap == 15)
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
                SendClientMessageToAll(0xFF0000FF, string);
                BanEx(i, "AntiCheat - Cane");
            }
        }
      if(ADMIN3[i] == false)
      {
            GetPlayerWeaponData(i, 1, weap, ammo);
            if(weap == 7)
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
                SendClientMessageToAll(0xFF0000FF, string);
                BanEx(i, "AntiCheat - Pool Cue");
            }
        }
      if(ADMIN4[i] == false)
      {
            GetPlayerWeaponData(i, 11, weap, ammo);
            if(weap == 44)
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
                SendClientMessageToAll(0xFF0000FF, string);
                BanEx(i, "AntiCheat - Nightvision");
            }
        }
      if(ADMIN5[i] == false)
      {
            GetPlayerWeaponData(i, 11, weap, ammo);
            if(weap == 45)
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
                SendClientMessageToAll(0xFF0000FF, string);
                BanEx(i, "AntiCheat - Thermal Goggles");
            }
        }
      if(ADMIN6[i] == false)
      {
            GetPlayerWeaponData(i, 9, weap, ammo);
            if(weap == 43)
            {
                new string [128];
                new pName[MAX_PLAYER_NAME];
                GetPlayerName(i, pName, sizeof(pName));
                format(string, sizeof(string), "BANNED: %s has been auto banned by console.", pName);
                SendClientMessageToAll(0xFF0000FF, string);
                BanEx(i, "AntiCheat - Camera");
            }
        }
    }
    return 1;
}
Reply
#2

Quote:
Originally Posted by Seif_
Use break; to stop the loop.
I assume that goes under all the BanEx's. So it compiles good and everything. Now is everything else 100% good and efficient?
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)