SA-MP Forums Archive
public OnRconLoginAttempt help - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: public OnRconLoginAttempt help (/showthread.php?tid=140093)



public OnRconLoginAttempt help - johnathon956 - 07.04.2010

im using it but i want it to have 3 attemts before it kicks

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
  if(!success) //If the password was incorrect
  {
    printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
    new pip[16];
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
      GetPlayerIp(i, pip, sizeof(pip));
      if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
      {
        SendClientMessage(i, 0xFFFFFFFF, "Wrong Password!"); //Send a message
                Kick(i);
            }
    }
  }
  return 1;
}



Re: public OnRconLoginAttempt help - ZeRo_HUN - 07.04.2010

Quote:
Originally Posted by johnathon956
im using it but i want it to have 3 attemts before it kicks

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
  if(!success) //If the password was incorrect
  {
    printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
    new pip[16];
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
      GetPlayerIp(i, pip, sizeof(pip));
      if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
      {
        SendClientMessage(i, 0xFFFFFFFF, "Wrong Password!"); //Send a message
                Kick(i);
            }
    }
  }
  return 1;
}
Use PVars, like this:

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
  if(!success) //If the password was incorrect
  {
    printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
    new pip[16];
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
      GetPlayerIp(i, pip, sizeof(pip));
      if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
      {
        SendClientMessage(i, 0xFFFFFFFF, "Wrong Password!"); //Send a message
                SetPVarInt( i, "PasswordWarnings", GetPVarInt( i, "PasswordWarnings" ) + 1 );
        if( GetPVarInt( i, "PasswordWarnings" ) == 3 ) {
          DeletePVar( i, "PasswordWarnings" );
                    Kick(i);
                }
            }
        }
  }
  return 1;
}
E: Sorry for the indentation, I don't know why, but it sucks now.


Re: public OnRconLoginAttempt help - johnathon956 - 07.04.2010

Quote:
Originally Posted by ZeRo_HUN
Quote:
Originally Posted by johnathon956
im using it but i want it to have 3 attemts before it kicks

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
  if(!success) //If the password was incorrect
  {
    printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
    new pip[16];
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
      GetPlayerIp(i, pip, sizeof(pip));
      if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
      {
        SendClientMessage(i, 0xFFFFFFFF, "Wrong Password!"); //Send a message
                Kick(i);
            }
    }
  }
  return 1;
}
Use PVars, like this:

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
  if(!success) //If the password was incorrect
  {
    printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
    new pip[16];
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
      GetPlayerIp(i, pip, sizeof(pip));
      if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
      {
        SendClientMessage(i, 0xFFFFFFFF, "Wrong Password!"); //Send a message
                SetPVarInt( i, "PasswordWarnings", GetPVarInt( i, "PasswordWarnings" ) + 1 );
        if( GetPVarInt( i, "PasswordWarnings" ) == 3 ) {
          DeletePVar( i, "PasswordWarnings" );
                    Kick(i);
                }
            }
        }
  }
  return 1;
}
E: Sorry for the indentation, I don't know why, but it sucks now.
to use pvar do i need r7 server


Re: public OnRconLoginAttempt help - ZeRo_HUN - 07.04.2010

Quote:
Originally Posted by johnathon956
Quote:
Originally Posted by ZeRo_HUN
Quote:
Originally Posted by johnathon956
im using it but i want it to have 3 attemts before it kicks

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
  if(!success) //If the password was incorrect
  {
    printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
    new pip[16];
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
      GetPlayerIp(i, pip, sizeof(pip));
      if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
      {
        SendClientMessage(i, 0xFFFFFFFF, "Wrong Password!"); //Send a message
                Kick(i);
            }
    }
  }
  return 1;
}
Use PVars, like this:

pawn Код:
public OnRconLoginAttempt(ip[], password[], success)
{
  if(!success) //If the password was incorrect
  {
    printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
    new pip[16];
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
      GetPlayerIp(i, pip, sizeof(pip));
      if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
      {
        SendClientMessage(i, 0xFFFFFFFF, "Wrong Password!"); //Send a message
                SetPVarInt( i, "PasswordWarnings", GetPVarInt( i, "PasswordWarnings" ) + 1 );
        if( GetPVarInt( i, "PasswordWarnings" ) == 3 ) {
          DeletePVar( i, "PasswordWarnings" );
                    Kick(i);
                }
            }
        }
  }
  return 1;
}
E: Sorry for the indentation, I don't know why, but it sucks now.
to use pvar do i need r7 server
Yes, you need but you can do it with simple variables:

pawn Код:
new PassWarnings[ MAX_PLAYERS ] = { 0, ... };

public OnRconLoginAttempt(ip[], password[], success)
{
  if(!success) //If the password was incorrect
  {
    printf("FAILED RCON LOGIN BY IP %s USING PASSWORD %s",ip, password);
    new pip[16];
    for(new i=0; i<MAX_PLAYERS; i++) //Loop through all players
    {
      GetPlayerIp(i, pip, sizeof(pip));
      if(!strcmp(ip, pip, true)) //If a player's IP is the IP that failed the login
      {
        SendClientMessage(i, 0xFFFFFFFF, "Wrong Password!"); //Send a message
        ++PassWarnings[ i ];
        if( PassWarnings[ i ] == 3 ) {
          PassWarnings[ i ] = 0;
         Kick(i);
        }
      }
    }
  }
  return 1;
}



Re: public OnRconLoginAttempt help - johnathon956 - 07.04.2010

how can i put a reason for kicking


Re: public OnRconLoginAttempt help - Hiddos - 07.04.2010

Quote:
Originally Posted by johnathon956
how can i put a reason for kicking
Place a SendClientMessage() and probably a string before the Kick(..)