Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <a_samp>
- #define Arquivo_Log "logs.txt"
- main(){}
- public OnPlayerConnect(playerid)
- {
- new File:Logs = fopen(Arquivo_Log, io_append);
- if(Logs)
- {
- new string[128], IP[30], time[6];
- gettime(time[0], time[1], time[2]);
- getdate(time[5], time[4], time[3]);
- GetPlayerIp(playerid, IP, sizeof(IP));
- format(string,sizeof(string), "[%02d:%02d:%02d | %02d/%02d/%02d | IP: %s] %s conectou no servidor \r\n", time[0], time[1], time[2], time[3],time[4],time[5],IP,PlayerName(playerid));
- fwrite(Logs, string);
- fclose(Logs);
- }
- else
- {
- printf("Arquivo %s não encontrado", Arquivo_Log);
- }
- return 1;
- }
- public OnPlayerDisconnect(playerid, reason)
- {
- new File:Logs = fopen(Arquivo_Log, io_append);
- if(Logs)
- {
- new string[128], IP[30], time[6];
- gettime(time[0], time[1], time[2]);
- getdate(time[5], time[4], time[3]);
- GetPlayerIp(playerid, IP, sizeof(IP));
- format(string,sizeof(string), "[%02d:%02d:%02d | %02d/%02d/%02d | IP: %s] %s deslogou do servidor \r\n", time[0], time[1], time[2], time[3],time[4],time[5],IP,PlayerName(playerid));
- fwrite(Logs, string);
- fclose(Logs);
- }
- else
- {
- printf("Arquivo %s não encontrado", Arquivo_Log);
- }
- return 1;
- }
- PlayerName(playerid)
- {
- new nome[24];
- GetPlayerName(playerid, nome, sizeof(nome));
- return nome;
- }
Advertisement
Add Comment
Please, Sign In to add comment