seroff

Anti Forwards Emulator 1.0 By Seroff

Feb 20th, 2020
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.51 KB | None | 0 0
  1. #include <amxmodx>
  2.  
  3. #define LOG_FILE "addons/amxmodx/logs/emu_logs.log"
  4.  
  5. new PLUGIN[][]={
  6. "Anti Forwards Emulator",
  7. "1.0",
  8. "Seroff"
  9. };
  10.  
  11. new eDeafault[][]={
  12. "+forward",
  13. "-forward",
  14. "+jump",
  15. "-jump",
  16. "+duck",
  17. "-duck",
  18. "+back",
  19. "-back",
  20. "+left",
  21. "-left",
  22. "+right",
  23. "-right",
  24. "+showscores",
  25. "-showscores",
  26. "-attack",
  27. "+attack",
  28. "-attack2",
  29. "+attack2",
  30. "+movedown",
  31. "-movedown",
  32. "+mlook",
  33. "-mlook",
  34. "+moveleft",
  35. "-moveleft",
  36. "+moveright",
  37. "-moveright",
  38. "+reload",
  39. "-reload",
  40. "+klook",
  41. "-klook",
  42. "+speed",
  43. "-speed",
  44. "m_pitch"
  45. }
  46.  
  47. new i_logs,i_banreason,i_banmess,i_bantime,sLen,Trie:sConsole,sFileText[512],is_banned[33];
  48.  
  49. public plugin_init(){
  50. register_plugin(PLUGIN[0],PLUGIN[1],PLUGIN[2]);
  51. i_logs=register_cvar("fe_logs_enabled","1");
  52. i_banreason=register_cvar("fe_reason","ForwardEmulator");
  53. i_banmess=register_cvar("fe_banmess","amx_ban [time] [userid] [reason]");
  54. i_bantime=register_cvar("fe_bantime","10080");
  55. sConsole=TrieCreate();
  56. }
  57.  
  58. public plugin_cfg(){
  59. new szCFG[64],sLine[10];
  60. get_configsdir(szCFG, charsmax(szCFG));
  61. formatex(szCFG, charsmax(szCFG), "%s/Guard",szCFG);
  62. if(!dir_exists(szCFG))mkdir(szCFG);
  63. formatex(sFileText,charsmax(sFileText),"%s/emu_console.ini",szCFG);
  64. formatex(szCFG,charsmax(szCFG),"%s/emu_main.cfg",szCFG);
  65. if(!file_exists(szCFG)){
  66. new fileid = fopen(szCFG,"at");
  67. if(fileid){
  68. fprintf(fileid, "fe_logs_enabled ^"1^" // включить логи?^n");
  69. fprintf(fileid, "fe_reason ^"ForwardEmulator^" // причина наказания^n");
  70. fprintf(fileid, "fe_banmess ^"amx_ban [time] [userid] [reason]^" // способ наказания^n");
  71. fprintf(fileid, "fe_bantime ^"10080^" // время наказания^n");
  72. fprintf(fileid, "^necho ^"^"^n");
  73. fprintf(fileid, "echo ^"Anti Emulator CONFIG Active^"");
  74. fprintf(fileid, "^necho ^"^"^n");
  75. }
  76. fclose(fileid);
  77. }
  78. server_cmd("exec %s",szCFG); server_exec();
  79.  
  80. if(!file_exists(sFileText)){
  81. new fileid = fopen(sFileText,"at");
  82. if(fileid){
  83. fprintf(fileid, "[AntiCheat] Вы наказаны!^n");
  84. fprintf(fileid, "[AntiCheat] Использование эмулятора запрещается^n");
  85. fprintf(fileid, "[AntiCheat] Большая просьба отключить эмулятор^n");
  86. fprintf(fileid, "[AntiCheat] Жаль, что ты используешь такой бред!^n");
  87. }
  88. fclose(fileid);
  89. }
  90. if(file_exists(sFileText)){
  91. new iFilePointer = fopen( sFileText, "r");
  92. if(iFilePointer != 0){
  93. new szData[128];
  94. while(fgets(iFilePointer, szData, 127)){
  95. remove_quotes(szData);
  96. trim(szData);
  97. if(strlen(szData)){
  98. sLen++
  99. num_to_str ( sLen-1, sLine, charsmax(sLine) );
  100. TrieSetString(sConsole,sLine,szData);
  101. }
  102. }
  103. fclose(iFilePointer);
  104. }
  105. }
  106. }
  107.  
  108. public client_putinserver(id) is_banned[id]=0;
  109.  
  110. public client_command(id){
  111. if(!is_user_connected(id) || is_banned[id]) return;
  112. new temp[128];
  113. read_argv(0, temp, 127);
  114. for(new i=0;i<sizeof(eDeafault);i++){
  115. if(equal(temp,eDeafault[i])){
  116. PunishPlayer(id,temp);
  117. }
  118. }
  119. }
  120.  
  121. public plugin_end() {
  122. TrieDestroy(sConsole);
  123. }
  124.  
  125.  
  126. stock get_configsdir(name[],len){
  127. return get_localinfo("amxx_configsdir",name,len);
  128. }
  129.  
  130. stock PunishPlayer(id, const Value[]){
  131. if(is_user_alive(id)) user_kill(id,1);
  132. is_banned[id]=1;
  133. new szUserId[10], szSteam[33], szIp[17], szTime[10], szBanString[128],izReason[128],sName[32],s_Buffer[512],sLine[10];
  134. formatex(szUserId, charsmax(szUserId), "#%d", get_user_userid(id));
  135. get_pcvar_string(i_banmess,szBanString,charsmax(szBanString));
  136. get_pcvar_string(i_banreason,izReason,charsmax(izReason));
  137. get_user_authid(id, szSteam, charsmax(szSteam));
  138. get_user_ip(id, szIp, charsmax(szIp), 1);
  139. get_user_name(id,sName,31);
  140. get_pcvar_string(i_bantime, szTime, charsmax(szTime));
  141. replace_string(szBanString, charsmax(szBanString), "[userid]", szUserId);
  142. replace_string(szBanString, charsmax(szBanString), "[steam]", szSteam);
  143. replace_string(szBanString, charsmax(szBanString), "[ip]", szIp);
  144. replace_string(szBanString, charsmax(szBanString), "[reason]", izReason);
  145. replace_string(szBanString, charsmax(szBanString), "[time]", szTime);
  146. if(get_pcvar_num(i_logs))log_to_file(LOG_FILE,"%s >> %s: [%s]", sName, Value, izReason);
  147. for(new i=0;i<sLen;i++){
  148. num_to_str ( i, sLine, charsmax(sLine) );
  149. TrieGetString(sConsole,sLine,s_Buffer,charsmax(s_Buffer));
  150. user_console(id,s_Buffer);
  151. }
  152. ChatColor(0, "^4Внимание:^1 Игрок ^3%s^1 наказан по причине ^3[^4%s^3]^1!", sName, izReason);
  153. server_cmd("%s", szBanString);
  154. }
  155.  
  156. stock user_console(id,const msg_content[],any:...){
  157. new msg[192];
  158. vformat(msg, sizeof(msg)-1, msg_content, 3);
  159. format(msg,sizeof(msg)-1,"%s^n",msg);
  160. message_begin(MSG_ONE, 8, {0,0,0}, id);
  161. write_string(msg);
  162. message_end();
  163. }
  164.  
  165. /* Сток цветного чата */
  166. stock ChatColor(const id, const input[], any:...)
  167. {
  168. new count = 1, players[32]
  169. static msg[191]
  170. vformat(msg, 190, input, 3)
  171. replace_all(msg, 190, "!g", "^4") // Зелёный
  172. replace_all(msg, 190, "!y", "^1") // Стандартный
  173. replace_all(msg, 190, "!t", "^3") // Цвет команды
  174. if (id) players[0] = id; else get_players(players, count, "ch")
  175. {
  176. for (new i = 0; i < count; i++)
  177. {
  178. if (is_user_connected(players[i]))
  179. {
  180. message_begin(MSG_ONE_UNRELIABLE, get_user_msgid("SayText"), _, players[i])
  181. write_byte(players[i]);
  182. write_string(msg);
  183. message_end();
  184. }
  185. }
  186. }
  187. }
Advertisement
Add Comment
Please, Sign In to add comment