Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <amxmodx>
- #define LOG_FILE "addons/amxmodx/logs/cmd_commands_logs.log"
- #define NOT_SHOW "addons/amxmodx/configs/notshow_command.ini"
- #define BAD_SHOW "addons/amxmodx/configs/badshow_command.ini"
- #define CONFIG_FILE "addons/amxmodx/configs/cmdshowconsole.cfg"
- new player[32], name[32], count, i, i_logs, i_bad, i_bantype, i_bantime;
- static CONFIG_SAVE[] = "cmd_logs_enabled ^"1^" // Включить логи?^rcmd_badshow_use ^"1^" // Проверять на плохие команды^rcmd_bantype ^"0^" // Тип наказания: 0 - кик, 1 - бан по ip, 2 - advanced bans, 3 - AMXBANS 5, 4 - AMXBANS 6, 5 - SuperBan, 6 - Fresh Bans^rcmd_bantime ^"10080^" // Время бана если тип наказания не равен 0^r^necho ^"CMD SHOW Config Executed^""
- public plugin_init()
- {
- register_plugin("CMD SHOW", "2.0", "Seroff")
- i_logs=register_cvar("cmd_logs_enabled","1")
- i_bad=register_cvar("cmd_badshow_use","1")
- i_bantype=register_cvar("cmd_bantype","0")
- i_bantime=register_cvar("cmd_bantime","10080")
- }
- public plugin_cfg()
- {
- TryConfig()
- server_cmd("exec %s",CONFIG_FILE)
- }
- stock TryConfig() {
- if ( file_exists(CONFIG_FILE) )
- return false
- new F = fopen( CONFIG_FILE , "w" )
- fputs( F , CONFIG_SAVE )
- fclose( F )
- return true
- }
- public client_command(id)
- {
- new BadEnable=get_pcvar_num(i_bad);
- new BanType=get_pcvar_num(i_bantype);
- new LogsEnable=get_pcvar_num(i_logs);
- new BanTime=get_pcvar_num(i_bantime);
- new sIp[16], sAuthid[34], sName[33];
- get_user_authid(id, sAuthid, 33);
- get_user_name(i, sName, 32)
- new sUserid = get_user_userid(id);
- new cmd[128], temp[128];
- read_argv(0, temp, 127)
- new iFile = fopen( NOT_SHOW, "rt" );
- if( !iFile )
- {
- set_fail_state("Where is your config, MotherFucker?!");
- }
- while( !feof( iFile ) )
- {
- #define MAX_STRING_LENGHT 32
- static szText[ MAX_STRING_LENGHT ]; fgets( iFile, szText, charsmax( szText ) ); trim( szText );
- if( !strlen( szText ) || szText[ 0 ] == ';' || ( szText[ 0 ] == '/' && szText[ 1 ] == '/' ) )
- continue;
- if(equal(temp,szText)) return
- }
- fclose( iFile );
- if(BadEnable)
- {
- new iFile = fopen( BAD_SHOW, "rt" );
- if( !iFile )
- {
- set_fail_state("Where is your config, MotherFucker?!");
- }
- while( !feof( iFile ) )
- {
- #define MAX_STRING_LENGHT 32
- static szText[ MAX_STRING_LENGHT ]; fgets( iFile, szText, charsmax( szText ) ); trim( szText );
- if( !strlen( szText ) || szText[ 0 ] == ';' || ( szText[ 0 ] == '/' && szText[ 1 ] == '/' ) )
- continue;
- if(equal(temp,szText)) {
- switch(BanType)
- {
- case 0:
- {
- ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
- server_cmd("kick #%d %s обнаружен!",sUserid,szText)
- }
- case 1:
- {
- ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
- server_cmd("addip %d %s;writeip",BanTime,sIp)
- }
- case 2:
- {
- if(containi(sAuthid,"STEAM_0:")!=-1)
- {
- ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
- server_cmd("amx_ban #%d %d ^"%s обнаружен!^"",sUserid,BanTime,szText)
- }
- else
- {
- ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
- server_cmd("amx_banip #%d %d ^"%s обнаружен!^"",sUserid,BanTime,szText)
- }
- }
- case 3:
- {
- ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
- server_cmd("amx_ban %d #%d ^"%s обнаружен!^"",BanTime,sUserid,szText)
- }
- case 4:
- {
- ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
- server_cmd("amx_ban #%d %d ^"%s обнаружен!^"",sUserid,BanTime,szText)
- }
- case 5:
- {
- ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
- server_cmd("amx_superban #%d %d ^"%s обнаружен!^"",sUserid,BanTime,szText)
- }
- case 6:
- {
- ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
- server_cmd("fb_ban %d #%d ^"%s обнаружен!^"",BanTime,sUserid,szText)
- }
- }
- }
- }
- }
- for(i=0; i < read_argc (); i++){
- read_argv(i, temp, 127)
- format(cmd, 127, "%s %s", cmd, temp)
- }
- get_user_name(id, name, 31)
- get_players(player, count, "h")
- for(i=0; i < count; i++){
- if(get_user_flags(player[i]) & ADMIN_KICK)
- {
- client_print(player[i], print_console, "%s >> %s: [%s ]", get_user_flags(id) & ADMIN_KICK ? "Admin" : "Player", name, cmd)
- }
- if(LogsEnable)
- {
- log_to_file(LOG_FILE,"%s >> %s: [%s ]", get_user_flags(id) & ADMIN_KICK ? "Admin" : "Player", name, cmd)
- }
- }
- }
- /* Сток цветного чата */
- stock ChatColor(const id, const input[], any:...)
- {
- new count = 1, players[32]
- static msg[191]
- vformat(msg, 190, input, 3)
- replace_all(msg, 190, "!g", "^4") // Зелёный
- replace_all(msg, 190, "!y", "^1") // Стандартный
- replace_all(msg, 190, "!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]))
- {
- message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
- write_byte(players[i]);
- write_string(msg);
- message_end();
- }
- }
- }
- }
- /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
- *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
- */
Advertisement
Add Comment
Please, Sign In to add comment