seroff

Log Show By 1.2 Seroff

Dec 26th, 2015
124
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.68 KB | None | 0 0
  1. #include <amxmodx>
  2.  
  3. static i_logfolder;
  4.  
  5. public plugin_init()
  6. {
  7. register_plugin("Log Show", "1.2", "Seroff");
  8. register_clcmd("show_log","logshow");
  9. i_logfolder=register_cvar("show_logs_dir","addons/amxmodx/logs/");
  10. }
  11.  
  12. public logshow(id){
  13. if(get_user_flags(id) & ADMIN_IMMUNITY){
  14. logss(id);
  15. }
  16. else
  17. {
  18. console_print(id,"Не достаточно пиздат для использования этой команды!");
  19. }
  20. return 1;
  21. }
  22.  
  23. public logss(id){
  24. new szFolder[64],szlog[128],szArg[64];
  25. read_argv(1,szArg,charsmax(szArg));
  26. get_pcvar_string(i_logfolder,szFolder,63)
  27. format(szlog, 63, "/%s/%s", szFolder, szArg)
  28. new iFile = fopen( szlog, "rt" );
  29. if( !iFile )
  30. {
  31. console_print(id,"Ошибка файл %s в папке %s отсутствует!",szArg,szFolder);
  32. }
  33. else
  34. {
  35. while( !feof( iFile ) )
  36. {
  37. static szText[ 92 ]; fgets( iFile, szText, charsmax( szText ) ); trim( szText );
  38.  
  39. if( !strlen( szText ) || szText[ 0 ] == ';' || ( szText[ 0 ] == '/' && szText[ 1 ] == '/' ) ) continue;
  40. console_print(id,"Папка: %s; Файл: %s",szFolder,szArg);
  41. console_print(id,szText);
  42. }
  43. }
  44. fclose( iFile );
  45. }
  46.  
  47.  
  48.  
  49. /*
  50. Админский плагин который показывает что есть в лог файле прям в игре не выходя с сервера!
  51. При вводе команды show_log выводится то что находится в файле, который указан в кваре.
  52.  
  53. Настройки:
  54. show_logs_dir "addons/amxmodx/logs/" // папка где находится лог файл
  55. show_logs_file "123.log" // лог файл
  56. */
Advertisement
Add Comment
Please, Sign In to add comment