Anticheat, ID 0 always getting kicked/banned
#1

Ok guys, listen, im making to try a similair Anticheat to crazybobs XD
But ive already had help here, i cant figure this out. It has to check all players, and check if they have any weapons in the row DetectWeapons. ID 0 is ALWAYS getting banned.

Please help me fix this shit.

Heres the code:


pawn Код:
new DetectWeapons[] = { 8, 9, 16, 17, 21, 35, 36, 37, 38, 42 };

public TestWeapons(playerid)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
        new Name[MAX_PLAYER_NAME+1];
        new Player;
        GetPlayerName(Player, Name, sizeof(Name));
        Player = GetPlayerID(Name);
   
    if (IsPlayerConnected(i))
    {
      if(!IsPlayerAdmin(i)) {
        new pWeapon = GetPlayerWeapon(i);

        for (i = 0; i < sizeof(DetectWeapons); i++)
                if (pWeapon == DetectWeapons[i])
                {
                    SendClientMessageToAll(COLOR_RED, "You've Been Caught Using A Forbidden Weapon!");
                    printf("[DC-AntiCheat] %s (%d) Has Been Killed By DC Anticheat. (Weapon ID: %d)", Name, Player, pWeapon);
                    SetPlayerInterior(Player, 6);
                    SetPlayerPos(Player, 264.2752, 81.9539, 1001.0391);
                    SetPlayerSpecialAction(Player, SPECIAL_ACTION_HANDSUP);
                    SetPlayerFacingAngle(Player, 260);

                    new NewKilled = dini_Int("server.ini", "ACKilled") + 1;
                    dini_IntSet("server.ini", "ACKilled", NewKilled);
                   
                    Kick(i);
                }
            }
        }
    }
  return 1;
}
Reply


Messages In This Thread

Forum Jump:


Users browsing this thread: 1 Guest(s)