Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Plugin generated by AMXX-Studio */
- #include <amxmodx>
- #define ADMIN_LEVEL ADMIN_IMMUNITY
- #define LOGS_DIR "addons/amxmodx/logs/"
- public plugin_init() {
- register_plugin("Show Erros Logs And Show Logs", "1.5", "Seroff");
- register_logevent("event_end", 2, "1=Round_End");
- register_clcmd("show_log","logshow");
- }
- public logshow(id){
- if(get_user_flags(id) & ADMIN_LEVEL){
- new szFile[64],szArg[64];
- read_argv(1,szArg,charsmax(szArg));
- formatex(szFile,charsmax(szFile),"%s%s",LOGS_DIR,szArg)
- new iFile = fopen( szFile, "rt" );
- if( !iFile )
- {
- console_print(id,"Ошибка файл %s отсутствует!",szFile);
- }
- else
- {
- while( !feof( iFile ) )
- {
- static szText[ 92 ]; fgets( iFile, szText, charsmax( szText ) ); trim( szText );
- if( !strlen( szText ) || szText[ 0 ] == ';' || ( szText[ 0 ] == '/' && szText[ 1 ] == '/' ) ) continue;
- console_print(id,szText);
- }
- }
- fclose( iFile );
- }
- else
- {
- console_print(id,"Не достаточно пиздат для использования этой команды!");
- }
- return 1;
- }
- public event_end(){
- static dir, files[32], cErrors,cLogs,szText[32];
- dir = open_dir(LOGS_DIR, files, sizeof(files)-1);
- if (dir)
- {
- cErrors=0;
- cLogs=0;
- while (next_file(dir, files, sizeof(files)-1))
- {
- if(containi(files, ".log") != -1)
- {
- cLogs++
- }
- if(containi(files, "error_") != -1)
- {
- cErrors++;
- szText=files;
- server_print("Обноружен лог файл с ошибками: %s",files);
- }
- }
- if(cErrors){
- Admin_ColorChat(0,"^1[^4Сервер^1] ^4Внимание^1: ^3обноружен лог файл с ошибками последний^1: [^4%s^1]!",szText);
- Admin_ColorChat(0,"^1[^4Сервер^1] ^4Внимание^1: ^3количество лог файлов с ошибками ^1: [^4%d^1/^4%d^1]!",cErrors,cLogs);
- }
- server_print("Количество лог файлов с ошибками: %d/%d", cErrors,cLogs);
- }
- close_dir(dir)
- }
- stock Admin_ColorChat(id, const input[], any:...) {
- new count = 1, players[32];
- static msg[191];
- vformat(msg, 190, input, 3);
- replace_all(msg, 187, "!g", "^4");
- replace_all(msg, 187, "!y", "^1");
- replace_all(msg, 187, "!t", "^3");
- if(id) players[0] = id; else get_players(players, count, "ch");
- {
- for(new i = 0; i < count; i++) {
- if(!is_user_connected(players[i]) || ~get_user_flags(players[i]) & ADMIN_IMMUNITY) continue;
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i]);
- write_byte(players[i]);
- write_string(msg);
- message_end();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment