logging connections ip
#1

Hai,i need help with logging ip of players that connect to server.

Example: I connect to server and he write my ip in ip_log.txt file with : Connected IP: XX.XX.XX.XX | Nick: blabla | Date: 02/10/1990

Thanks D:
Reply
#2

Code:
OnPlayerConnect(playerid)
{
  new name[MAX_PLAYER_NAME], ip[40], string[200], day, month, year;
  GetPlayerName(playerid, name, sizeof(name));
  GetPlayerIp(playerid, ip, sizeof(ip));
  getdate(year, month, day);
  format(string, sizeof(string), "Connected IP: %s | Nick: %s | Date: %d/%d/%d \r\n", ip, name, day, month, year);
  if(fexist(ip_log.txt)){
    new File:log = fopen("ip_log.txt", io_append);
    fwrite(log, string);
    fclose(log);
  }
  return 1;
}
I hope it works :P.. if not contact me and I'll overwork it again (just wrote it up)..
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)