For loop or OnRconLoginAttemp bug ?
#1

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
  //#if allow == true
  if(!success) //If the password was incorrect
  {
    new playerip[16];
        print("OnRconLoginAttempt - Called ~");
    for(new i; i < MAX_PLAYERS; i++)
    {
      GetPlayerIp(i, playerip, sizeof(playerip));
      if(!strcmp(ip, playerip, true))
      {
        SendClientMessage(i, 0xFFFFFFFF, "Wrong Password. Bye!");
        printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s !",ip, password);
        Ban(i);
      }
    }
    print("OnRconLoginAttempt - Called after ~ for loop ~");
  }
  //#endif
  return 1;
}
I type /rcon login wrong_password , i got banned , but in server_log i recive 300 msg ( 300 = MAX_PLAYERS )

http://pastebin.com/m18d31b53
Reply
#2

Try adding 'break;' after Ban(i)
Reply
#3

his fix would work, but it is probobly because if the player isn't connected GetPlayerIp doesn't put anything into playerip, meaning it equals what it used too.
Reply
#4

Ah yes, IsPlayerConnected misses in your loop. Consider using foreach by the way
Reply
#5

Non logged players have 255.255.255.255 as their IP, which cannot be compared that way.
Useless to add it.
Wiki: https://sampwiki.blast.hk/wiki/OnRconLoginAttemptMy bad, it is the code from wiki, use break or return.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)