Advertisement
Guest User

fwrite logs

a guest
Jul 3rd, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 KB | None | 0 0
  1. stock WriteToFile(file[],string[])
  2. {
  3. new File:filea = fopen(file,io_append);
  4. fwrite(filea, string);
  5. -----------------------------------
  6. stock LogAccount(const text[])
  7. {
  8. new final[256], Int[6],fileo[64];
  9. getdate(Int[0],Int[1],Int[2]);
  10. new File:file = fopen("tf2/logs/account.ini",io_append);
  11.  
  12. gettime(Int[3],Int[4],Int[5]);
  13. format(final, sizeof(final),"[%d/%d/%d] [%d:%d:%d] %s\r\n",Int[2],Int[1],Int[0],Int[3],Int[4],Int[5],text);
  14. fwrite(file, final);
  15. fclose(file);
  16.  
  17.  
  18. format(fileo, sizeof(fileo),"tf2/logs/account/%d-%d-%d.ini",Int[2],Int[1],Int[0]);
  19. new File:file2 = fopen(fileo,io_append);
  20. format(final, sizeof(final),"[%d:%d:%d] %s\r\n",Int[3],Int[4],Int[5],text);
  21. fwrite(file2, final);
  22. fclose(file2);
  23. return 1;
  24. }
  25. ---------------------------
  26. stock LogPunishment(const text[])
  27. {
  28. new final[256], Int[6],fileo[64];
  29. getdate(Int[0],Int[1],Int[2]);
  30. new File:file = fopen("tf2/logs/punishments.ini",io_append);
  31.  
  32. gettime(Int[3],Int[4],Int[5]);
  33. format(final, sizeof(final),"[%d/%d/%d] [%d:%d:%d] %s\r\n",Int[2],Int[1],Int[0],Int[3],Int[4],Int[5],text);
  34. fwrite(file, final);
  35. fclose(file);
  36.  
  37. format(fileo, sizeof(fileo),"tf2/logs/punishments/%d-%d-%d.ini",Int[2],Int[1],Int[0]);
  38. new File:file2 = fopen(fileo,io_append);
  39. format(final, sizeof(final),"[%d:%d:%d] %s\r\n",Int[3],Int[4],Int[5],text);
  40. fwrite(file2, final);
  41. fclose(file2);
  42. return 1;
  43. }
  44. -------------------------------
  45. stock Log(const text[])
  46. {
  47. new Int[3],fileo[64],final[256];
  48. getdate(Int[0],Int[1],Int[2]);
  49.  
  50. format(fileo, sizeof(fileo),"tf2/logs/%d-%d-%d.ini",Int[2],Int[1],Int[0]);
  51. new File:file = fopen(fileo,io_append);
  52.  
  53. gettime(Int[0],Int[1],Int[2]);
  54. format(final, sizeof(final),"[%d:%d:%d] %s\r\n",Int[0],Int[1],Int[2],text);
  55. fwrite(file, final);
  56. fclose(file);
  57. return 1;
  58. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement