seroff

CMD SHOW 2.0 By Seroff

Dec 27th, 2015
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 6.20 KB | None | 0 0
  1. #include <amxmodx>
  2.  
  3. #define LOG_FILE "addons/amxmodx/logs/cmd_commands_logs.log"
  4. #define NOT_SHOW "addons/amxmodx/configs/notshow_command.ini"
  5. #define BAD_SHOW "addons/amxmodx/configs/badshow_command.ini"
  6. #define CONFIG_FILE "addons/amxmodx/configs/cmdshowconsole.cfg"
  7.  
  8. new player[32], name[32], count, i, i_logs, i_bad, i_bantype, i_bantime;
  9.  
  10. 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^""
  11.  
  12.  
  13. public plugin_init()
  14. {
  15. register_plugin("CMD SHOW", "2.0", "Seroff")
  16. i_logs=register_cvar("cmd_logs_enabled","1")
  17. i_bad=register_cvar("cmd_badshow_use","1")
  18. i_bantype=register_cvar("cmd_bantype","0")
  19. i_bantime=register_cvar("cmd_bantime","10080")
  20. }
  21.  
  22. public plugin_cfg()
  23. {
  24. TryConfig()
  25. server_cmd("exec %s",CONFIG_FILE)
  26. }
  27.  
  28. stock TryConfig() {
  29.  
  30. if ( file_exists(CONFIG_FILE) )
  31.  
  32. return false
  33.  
  34. new F = fopen( CONFIG_FILE , "w" )
  35.  
  36. fputs( F , CONFIG_SAVE )
  37.  
  38. fclose( F )
  39.  
  40.  
  41. return true
  42.  
  43. }
  44.  
  45. public client_command(id)
  46. {
  47. new BadEnable=get_pcvar_num(i_bad);
  48. new BanType=get_pcvar_num(i_bantype);
  49. new LogsEnable=get_pcvar_num(i_logs);
  50. new BanTime=get_pcvar_num(i_bantime);
  51. new sIp[16], sAuthid[34], sName[33];
  52. get_user_authid(id, sAuthid, 33);
  53. get_user_name(i, sName, 32)
  54. new sUserid = get_user_userid(id);
  55. new cmd[128], temp[128];
  56.  
  57. read_argv(0, temp, 127)
  58.  
  59. new iFile = fopen( NOT_SHOW, "rt" );
  60.  
  61. if( !iFile )
  62. {
  63. set_fail_state("Where is your config, MotherFucker?!");
  64. }
  65.  
  66. while( !feof( iFile ) )
  67. {
  68. #define MAX_STRING_LENGHT 32
  69.  
  70. static szText[ MAX_STRING_LENGHT ]; fgets( iFile, szText, charsmax( szText ) ); trim( szText );
  71.  
  72. if( !strlen( szText ) || szText[ 0 ] == ';' || ( szText[ 0 ] == '/' && szText[ 1 ] == '/' ) )
  73. continue;
  74. if(equal(temp,szText)) return
  75. }
  76.  
  77. fclose( iFile );
  78.  
  79.  
  80. if(BadEnable)
  81. {
  82. new iFile = fopen( BAD_SHOW, "rt" );
  83.  
  84. if( !iFile )
  85. {
  86. set_fail_state("Where is your config, MotherFucker?!");
  87. }
  88.  
  89. while( !feof( iFile ) )
  90. {
  91. #define MAX_STRING_LENGHT 32
  92.  
  93. static szText[ MAX_STRING_LENGHT ]; fgets( iFile, szText, charsmax( szText ) ); trim( szText );
  94.  
  95. if( !strlen( szText ) || szText[ 0 ] == ';' || ( szText[ 0 ] == '/' && szText[ 1 ] == '/' ) )
  96. continue;
  97. if(equal(temp,szText)) {
  98. switch(BanType)
  99. {
  100. case 0:
  101. {
  102. ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
  103. server_cmd("kick #%d %s обнаружен!",sUserid,szText)
  104. }
  105. case 1:
  106. {
  107. ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
  108. server_cmd("addip %d %s;writeip",BanTime,sIp)
  109. }
  110. case 2:
  111. {
  112. if(containi(sAuthid,"STEAM_0:")!=-1)
  113. {
  114. ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
  115. server_cmd("amx_ban #%d %d ^"%s обнаружен!^"",sUserid,BanTime,szText)
  116. }
  117. else
  118. {
  119. ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
  120. server_cmd("amx_banip #%d %d ^"%s обнаружен!^"",sUserid,BanTime,szText)
  121. }
  122. }
  123. case 3:
  124. {
  125. ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
  126. server_cmd("amx_ban %d #%d ^"%s обнаружен!^"",BanTime,sUserid,szText)
  127. }
  128. case 4:
  129. {
  130. ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
  131. server_cmd("amx_ban #%d %d ^"%s обнаружен!^"",sUserid,BanTime,szText)
  132. }
  133.  
  134.  
  135. case 5:
  136. {
  137. ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
  138. server_cmd("amx_superban #%d %d ^"%s обнаружен!^"",sUserid,BanTime,szText)
  139. }
  140. case 6:
  141. {
  142. ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 использует запрещёную команду ^3[^4%s^3]^1!", sName, szText)
  143. server_cmd("fb_ban %d #%d ^"%s обнаружен!^"",BanTime,sUserid,szText)
  144. }
  145. }
  146. }
  147. }
  148. }
  149.  
  150. for(i=0; i < read_argc (); i++){
  151. read_argv(i, temp, 127)
  152. format(cmd, 127, "%s %s", cmd, temp)
  153. }
  154.  
  155. get_user_name(id, name, 31)
  156. get_players(player, count, "h")
  157. for(i=0; i < count; i++){
  158. if(get_user_flags(player[i]) & ADMIN_KICK)
  159. {
  160. client_print(player[i], print_console, "%s >> %s: [%s ]", get_user_flags(id) & ADMIN_KICK ? "Admin" : "Player", name, cmd)
  161. }
  162. if(LogsEnable)
  163. {
  164. log_to_file(LOG_FILE,"%s >> %s: [%s ]", get_user_flags(id) & ADMIN_KICK ? "Admin" : "Player", name, cmd)
  165. }
  166. }
  167.  
  168. }
  169.  
  170.  
  171. /* Сток цветного чата */
  172. stock ChatColor(const id, const input[], any:...)
  173. {
  174. new count = 1, players[32]
  175. static msg[191]
  176. vformat(msg, 190, input, 3)
  177.  
  178. replace_all(msg, 190, "!g", "^4") // Зелёный
  179. replace_all(msg, 190, "!y", "^1") // Стандартный
  180. replace_all(msg, 190, "!t", "^3") // Цвет команды
  181.  
  182. if (id) players[0] = id; else get_players(players, count, "ch")
  183. {
  184. for (new i = 0; i < count; i++)
  185. {
  186. if (is_user_connected(players[i]))
  187. {
  188. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  189. write_byte(players[i]);
  190. write_string(msg);
  191. message_end();
  192. }
  193. }
  194. }
  195. }
  196. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  197. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
  198. */
Advertisement
Add Comment
Please, Sign In to add comment