public OnRconLoginAttempt(ip[], password[], success)
#1

how can i use playerid in public OnRconLoginAttempt(ip[], password[], success)?

please help me ;/
Reply
#2

you need a R7 server
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;
}
Reply
#3

i would like to add something like that to it:

if(success == 1)
{
SendClientMessage(playerid, COLOR, "You have logged in.");
}

but playerid isn't working

is there some way i can get it to work?
Reply
#4

Well it already gives you a message when logging in, but you can do a custom one depending on the ip
pawn Код:
if(success)
{
  for(new i = 0; i < MAX_PLAYERS; i++)
  {
   if(strcmp(ip, PlayerIp(i), true) == 0)
   {
     SendClientMessage(i, COLOR, "You have logged in.");
     break;
   }
  }
}

PlayerIp(playerid)
{
  new ip[16];
  GetPlayerIp(playerid, ip, sizeof(ip));
  return ip;
}
Reply
#5

ok and i have another question

how can i delete the default message "SERVER: You have logged as an admin." ?

i tried return 0; but it doesnt work
Reply
#6

You can't AFAIK.
Reply


Forum Jump:


Users browsing this thread: