How to log this?
#9

Here yah go. http://pastebin.com/sv9ETgeG
Quote:
Originally Posted by Coole210
Here this will display name i just made it

Код:
public OnRconLoginAttempt(ip[], password[], success)
{
  if(!success)
  {
    printf("RCON LOGIN FAILED IP %s USING PASSWORD %s",ip, password);
    new pip[16];
    for(new i=0; i<MAX_PLAYERS; i++)
    {
      GetPlayerIp(i, pip, sizeof(pip));
      new Year,Month,Day,Hour,Minute,Second,namee[MAX_PLAYER_NAME];
      Getdate(Year,Month,Day);
      Gettime(Hour,Minute,Second);
      GetPlayerName(playerid,namee,sizeof(namee));
      format(string,sizeof(string),"[%02d-%02d-%02d @ %02d:%02d:%02d] %s[IP:%s] - Failed password: %s",Year,Month,Day,Hour,Minute,Second,namee,pip,password);
			new File: badattemptfile=fopen("Bad_Attempts.txt",io_append);
			if(!badattemptfile)
			{
			  fcreate("Bad_Attempts.txt");
			}
			fwrite(badattemptfile,string);
			fclose(badattemptfile);
			if(!strcmp(ip, pip, true))
      {
        SendClientMessage(i, 0xFFFFFFFF, "You typed the wrong password, DON'T DO IT AGAIN!");
        Kick(i);
      }
    }
  }
  return 1;
}
The reason I didn't do it like that, is because you shouldn't declare all those variables and get the time and get the date every single time. MAX_PLAYERS is equal to 500, meaning you would declare those variables and call those functions 500 times when you could just do it once.
Reply


Messages In This Thread
How to log this? - by MWF2 - 19.05.2010, 19:42
Re: How to log this? - by Backwardsman97 - 19.05.2010, 20:13
Re: How to log this? - by MWF2 - 19.05.2010, 22:35
Re: How to log this? - by Backwardsman97 - 19.05.2010, 23:15
Re: How to log this? - by MWF2 - 19.05.2010, 23:28
Re: How to log this? - by coole210 - 19.05.2010, 23:29
Re: How to log this? - by MWF2 - 19.05.2010, 23:37
Re: How to log this? - by coole210 - 19.05.2010, 23:42
Re: How to log this? - by Backwardsman97 - 20.05.2010, 00:00
Re: How to log this? - by MWF2 - 20.05.2010, 00:09

Forum Jump:


Users browsing this thread: 1 Guest(s)