29.12.2009, 16:55
Add this anywhere in your script:
and this above it
then add this under onplayerconnect:
pawn Code:
forward ConnectLog(playerid);
public ConnectLog(playerid)
{
new name[MAX_PLAYER_NAME];
GetPlayerName(playerid, name, sizeof(name));
new hour;
new minute;
new second;
new day;
new month;
new year;
getdate(year, month, day);
gettime(hour,minute,second);
new cmd[264];
new File:Connections;
Connections = fopen("logs/connections.log",io_append);
format(cmd,sizeof(cmd),"[%02d/%02d/%02d %02d:%02d:%02d] Player: %s || ID: %d || IP: %s connected. \r\n",day, month, year, hour, minute, second,name,playerid,PlayerIP(playerid));
fwrite(Connections,cmd);
fclose(Connections);
print(cmd);
return 1;
}
pawn Code:
stock PlayerIP(playerid)
{
new IP[264];
GetPlayerIp(playerid, IP, 264);
return IP;
}
pawn Code:
ConnectLog(playerid);