Advertisement
Guest User

KineticNRG

a guest
Sep 19th, 2008
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.59 KB | None | 0 0
  1. // __________________________________________________________________
  2. //|____[Lords Log Sytem Lite]________________________________________|
  3. //| This is a system that logs all things that are said by players |
  4. //| that is not done with a command. |
  5. //| |
  6. //| Author: KineticNRG |
  7. //|__________________________________________________________________|
  8. //
  9.  
  10. #include <lrp>
  11.  
  12. //--[logs]
  13. forward ChatLog(string[]);
  14.  
  15. public OnFilterScriptInit()
  16. {
  17. new str[128];
  18. //--[Create Logs]
  19. print(" ____________________________________________________");
  20. print("|_[Logs]_________________________________________[x]_|");
  21. print("|Loading Log... |");
  22. print("| |");
  23. format(str, sizeof(str), "/logs/chat.log");
  24. if(!fexist(str))
  25. {
  26. format(str, sizeof(str), "Chat log created.");
  27. ChatLog(str);
  28. printf("|%s Check scriptfiles/logs folder. |", str);
  29. }
  30. if(fexist(str))
  31. {
  32. print("|Chat Log Loaded. |");
  33. }
  34. print("|____________________________________________________|");
  35. print(" ");
  36.  
  37.  
  38. //The IsNumeric and ReturnUser are only in here to remove the error, They do nothing to the script but remove the warnings when compiling.
  39. new var;
  40. new vartxt[1];
  41. var = ReturnUser(vartxt);
  42. var = IsNumeric(vartxt);
  43. format(str, sizeof(str), "%d", var);
  44. //
  45.  
  46. return 1;
  47. }
  48. //
  49.  
  50. //
  51. public ChatLog(string[])
  52. {
  53. new str[256];
  54. new File:chatlog;
  55. chatlog = fopen("/logs/chat.log", io_append);
  56. new year;
  57. new month;
  58. new day;
  59. getdate(year, month, day);
  60. new hour;
  61. new minute;
  62. gettime(hour, minute);
  63. if(!fexist("/logs/chat.log"))
  64. {
  65. if (minute < 10)
  66. {
  67. format(str, sizeof(str), "[%d/%d/%d|%d:0%d] %s\r\n", month, day, year, hour, minute, string);
  68. }
  69. if(minute >= 10)
  70. {
  71. format(str, sizeof(str), "[%d/%d/%d|%d:%d] %s\r\n", month, day, year, hour, minute, string);
  72. }
  73. fwrite(chatlog, str);
  74. fclose(chatlog);
  75. return 1;
  76. }
  77. if (minute < 10)
  78. {
  79. format(str, sizeof(str), "[%d/%d/%d|%d:0%d] %s\r\n", month, day, year, hour, minute, string);
  80. }
  81. if(minute >= 10)
  82. {
  83. format(str, sizeof(str), "[%d/%d/%d|%d:%d] %s\r\n", month, day, year, hour, minute, string);
  84. }
  85. fwrite(chatlog, str);
  86. fclose(chatlog);
  87. return 1;
  88. }
  89. //
  90.  
  91. //
  92. public OnPlayerText(playerid, text[])
  93. {
  94. ChatLog(text);// anything that is typed that is not a command is logged here with this in the chat.log file.
  95. return 0;
  96. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement