Anti-Cheat Problem
#1

pawn Код:
public Antiweapon(playerid)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {    
    if (GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 36)
    {
       format(string, sizeof(string), "%s has been kicked for cheating", playername);
       SendClientMessageToAll(ADMIN_RED, string);
       banning[i] = 1;
       if(banning[i] == 1)
       {
         Kick(i);
       }
       return 1;
     }
   }
}
The problem is it kicks the first player on connect, after one player get's kicked by the anti-cheat, probably if the ID is the same. I also reset the banning variable to 0 on connect.

Anyone know what's wrong?
Reply
#2

Shouldn't i be playerid?
Reply
#3

Quote:
Originally Posted by backwardsman97
Shouldn't i be playerid?
Oh sorry, forgot to post my loop.

Check the first post, I appreciate the reply.
Reply
#4

Quote:
Originally Posted by tr0y
pawn Код:
public Antiweapon(playerid)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {    
    if (GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 36)
    {
      format(string, sizeof(string), "%s has been kicked for cheating", playername);
      SendClientMessageToAll(ADMIN_RED, string);
      banning[i] = 1;
      if(banning[i] == 1)
      {
         Kick(i);
       }
       return 1;
     }
  }
}
The problem is it kicks the first player on connect, after one player get's kicked by the anti-cheat, probably if the ID is the same. I also reset the banning variable to 0 on connect.

Anyone know what's wrong?
remove the banning variable its a waste of cells, you can just kick the dude you dont need to have an useless variable decide if he needs to be kicked.
Reply
#5

Quote:
Originally Posted by Pandabeer1337
Quote:
Originally Posted by tr0y
pawn Код:
public Antiweapon(playerid)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {    
    if (GetPlayerWeapon(i) == 38 || GetPlayerWeapon(i) == 35 || GetPlayerWeapon(i) == 36)
    {
      format(string, sizeof(string), "%s has been kicked for cheating", playername);
      SendClientMessageToAll(ADMIN_RED, string);
      banning[i] = 1;
      if(banning[i] == 1)
      {
         Kick(i);
       }
       return 1;
     }
  }
}
The problem is it kicks the first player on connect, after one player get's kicked by the anti-cheat, probably if the ID is the same. I also reset the banning variable to 0 on connect.

Anyone know what's wrong?
remove the banning variable its a waste of cells, you can just kick the dude you dont need to have an useless variable decide if he needs to be kicked.
I know, It's not needed, but the first player connecting keeps getting kicked, I taught reseting that variable on connect would fix the problem.

EDIT: Do I also need a loop, when doing SetTimerEx?
Reply
#6

You haven't got playername defined anywhere also, put parentheses around GetPlayerWeapon(i) and the number, so
((GetPlayerWeapon(i) == 3 || (GetPlayerWeapon(i) == 35) || (GetPlayerWeapon(i) == 36))
Reply
#7

Check OnPlayerConnect to see if there's a GivePlayerWeapon line.
If there is, check what ID the weapon the player's receiving is.
Reply
#8

Your origonal one wouldn't work because you return 1; before it can check all players.

well if that's a timer, you could just do:

pawn Код:
forward WeapCheck();
pawn Код:
public OnGameModeInit()
{
  SetTimer("WeapCheck",15000,1);
  return 1;
}
pawn Код:
public WeapCheck()
{
  for(new i; i<200;i++)
  {
    if((GetPlayerWeapon(i)==38)||(GetPlayerWeapon(i)==35)||(GetPlayerWeapon(i)==36))
    format(string, sizeof(string), "%s has been kicked for cheating", playername);
    SendClientMessageToAll(ADMIN_RED, string);
    Kick(i);
  }
  return 1;
}
Reply
#9

I don't understand why peopel bump such old topics
Reply
#10

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)