seroff

Show Erros Logs And Show Logs 1.5 By Seroff

Jul 11th, 2016
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.73 KB | None | 0 0
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4.  
  5. #define ADMIN_LEVEL ADMIN_IMMUNITY
  6. #define LOGS_DIR "addons/amxmodx/logs/"
  7.  
  8. public plugin_init() {
  9. register_plugin("Show Erros Logs And Show Logs", "1.5", "Seroff");
  10. register_logevent("event_end", 2, "1=Round_End");
  11. register_clcmd("show_log","logshow");
  12. }
  13.  
  14. public logshow(id){
  15. if(get_user_flags(id) & ADMIN_LEVEL){
  16. new szFile[64],szArg[64];
  17. read_argv(1,szArg,charsmax(szArg));
  18. formatex(szFile,charsmax(szFile),"%s%s",LOGS_DIR,szArg)
  19. new iFile = fopen( szFile, "rt" );
  20. if( !iFile )
  21. {
  22. console_print(id,"Ошибка файл %s отсутствует!",szFile);
  23. }
  24. else
  25. {
  26. while( !feof( iFile ) )
  27. {
  28. static szText[ 92 ]; fgets( iFile, szText, charsmax( szText ) ); trim( szText );
  29.  
  30. if( !strlen( szText ) || szText[ 0 ] == ';' || ( szText[ 0 ] == '/' && szText[ 1 ] == '/' ) ) continue;
  31. console_print(id,szText);
  32. }
  33. }
  34. fclose( iFile );
  35. }
  36. else
  37. {
  38. console_print(id,"Не достаточно пиздат для использования этой команды!");
  39. }
  40. return 1;
  41. }
  42.  
  43. public event_end(){
  44. static dir, files[32], cErrors,cLogs,szText[32];
  45. dir = open_dir(LOGS_DIR, files, sizeof(files)-1);
  46. if (dir)
  47. {
  48. cErrors=0;
  49. cLogs=0;
  50. while (next_file(dir, files, sizeof(files)-1))
  51. {
  52. if(containi(files, ".log") != -1)
  53. {
  54. cLogs++
  55. }
  56. if(containi(files, "error_") != -1)
  57. {
  58. cErrors++;
  59. szText=files;
  60. server_print("Обноружен лог файл с ошибками: %s",files);
  61. }
  62. }
  63.  
  64. if(cErrors){
  65. Admin_ColorChat(0,"^1[^4Сервер^1] ^4Внимание^1: ^3обноружен лог файл с ошибками последний^1: [^4%s^1]!",szText);
  66. Admin_ColorChat(0,"^1[^4Сервер^1] ^4Внимание^1: ^3количество лог файлов с ошибками ^1: [^4%d^1/^4%d^1]!",cErrors,cLogs);
  67. }
  68. server_print("Количество лог файлов с ошибками: %d/%d", cErrors,cLogs);
  69. }
  70. close_dir(dir)
  71. }
  72.  
  73.  
  74. stock Admin_ColorChat(id, const input[], any:...) {
  75. new count = 1, players[32];
  76. static msg[191];
  77. vformat(msg, 190, input, 3);
  78.  
  79. replace_all(msg, 187, "!g", "^4");
  80. replace_all(msg, 187, "!y", "^1");
  81. replace_all(msg, 187, "!t", "^3");
  82.  
  83. if(id) players[0] = id; else get_players(players, count, "ch");
  84. {
  85. for(new i = 0; i < count; i++) {
  86. if(!is_user_connected(players[i]) || ~get_user_flags(players[i]) & ADMIN_IMMUNITY) continue;
  87. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
  88. write_byte(players[i]);
  89. write_string(msg);
  90. message_end();
  91. }
  92. }
  93. }
Advertisement
Add Comment
Please, Sign In to add comment