Advertisement
Guest User

Sistema Log by Keller

a guest
Dec 11th, 2010
1,154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pawn 2.65 KB | None | 0 0
  1. #include <a_samp>
  2. #include <dini>
  3. new giveplayer[MAX_PLAYER_NAME];
  4. new Horalog[MAX_PLAYERS], Minutolog[MAX_PLAYERS], Segundolog[MAX_PLAYERS],Meslog[MAX_PLAYERS],Anolog[MAX_PLAYERS],Dialog[MAX_PLAYERS];
  5. #if defined FILTERSCRIPT
  6.  
  7. public OnFilterScriptInit()
  8. {
  9.     print("\n--------------------------------------");
  10.     print("       Sistema de Log by Keller         ");
  11.     print("--------------------------------------\n");
  12.     return 1;
  13. }
  14.  
  15. public OnFilterScriptExit()
  16. {
  17.     return 1;
  18. }
  19.  
  20. #else
  21.  
  22. main()
  23. {
  24.     print("\n----------------------------------");
  25.     print("      Sistema de Log by Keller      ");
  26.     print("----------------------------------\n");
  27. }
  28.  
  29. #endif
  30.  
  31. public OnPlayerConnect(playerid)
  32. {
  33.     new stringaa[128];
  34.     new stringgg[128];
  35.     GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
  36.     format(stringaa, sizeof(stringaa), "/LogK/%s.ini", giveplayer);
  37.     if(!dini_Exists(stringaa)) {
  38.         dini_Create(stringaa);
  39.     }
  40.     new File:logkeller = fopen(stringaa, io_append);
  41.     if(logkeller) {
  42.         new Ano, Mes,Dia;
  43.         getdate(Ano, Mes,Dia);
  44.         getdate(Anolog[playerid], Meslog[playerid],Dialog[playerid]);
  45.         new Hora, Minuto, Segundo;
  46.         gettime(Hora, Minuto, Segundo);
  47.         gettime(Horalog[playerid], Minutolog[playerid], Segundolog[playerid]);
  48.         format(stringgg, sizeof stringgg, "\r\n[%d/%d/%d]Logado ás %d:%d\r\n", Dia, Mes, Ano, Hora, Minuto);
  49.         fwrite(logkeller, stringgg);
  50.         fclose(logkeller);
  51.     }
  52.     return 1;
  53. }
  54.  
  55.  
  56. public OnPlayerDisconnect(playerid, reason)
  57. {
  58.     GetPlayerName(playerid, giveplayer, sizeof(giveplayer));
  59.     new stringaa[128];
  60.     new stringgg[128];
  61.     format(stringaa, sizeof(stringaa), "/LogK/%s.ini", giveplayer);
  62.     if(!dini_Exists(stringaa)) {
  63.         dini_Create(stringaa);
  64.     }
  65.     new File:logkeller = fopen(stringaa, io_append);
  66.     if(logkeller) {
  67.         new Ano, Mes,Dia;
  68.         getdate(Ano, Mes,Dia);
  69.         new Hora, Minuto, Segundo;
  70.         gettime(Hora, Minuto, Segundo);
  71.         new horaon = Hora-Horalog[playerid];
  72.         new minutoon = Minuto-Minutolog[playerid];
  73.         if(Dia != Dialog[playerid]) {
  74.             Hora = Hora+24;
  75.         }
  76.         if(minutoon < 0) {
  77.             minutoon = 60-Minutolog[playerid]+Minuto;
  78.             horaon = Hora-Horalog[playerid]-1;
  79.         }
  80.         format(stringgg, sizeof stringgg, "[%d/%d/%d]Deslogado ás %d:%d \r\n[%d/%d/%d]Tempo Logado: %d hora(s) e %d minuto(s)\r\n\r\n-----------------------------------------------------\r\n\r\n", Dia, Mes, Ano, Hora, Minuto, Dia, Mes, Ano, horaon, minutoon);
  81.         fwrite(logkeller, stringgg);
  82.         fclose(logkeller);
  83.     }
  84.     return 1;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement