seroff

Anti-Cheat (Cvar | FPS) 2.5 Seroff

Dec 27th, 2015
290
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.26 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <colorchat>
  5.  
  6. new bool:sBuild_new[33];
  7.  
  8. new WarFps[33],UserFPS[33], CheckFPS,MaxFps,CheckCVAR,Netgraph;
  9.  
  10. new g_CheckCvar[][] =
  11. {
  12. "gl_vsync","fps_max","fps_modem","fps_override","cl_sidespeed",
  13. "cl_forwardspeed","cl_backspeed","cl_yawspeed","developer","cl_filterstuffcmd",
  14. "m_pitch","m_yaw","cl_bob","cl_bobcycle","cl_bobup","cl_lw","cl_lc","net_graph"
  15. };
  16.  
  17. public plugin_init()
  18. {
  19. register_plugin("Anti-Cheat (Cvar | FPS)","2.5","Seroff");
  20. CheckFPS=register_cvar("Check_Fps","1");
  21. CheckCVAR=register_cvar("Check_Cvars", "1");
  22. Netgraph=register_cvar("write_net_graph", "3");
  23. MaxFps=register_cvar("Max_Fps", "111");
  24. register_forward(FM_CmdStart, "Player_CmdStart");
  25. register_forward(FM_PlayerPostThink, "Player_PostThink");
  26. }
  27.  
  28. public client_putinserver(id)
  29. {
  30. if(get_pcvar_num(CheckCVAR)==1){
  31. console_cmd(id,"cl_sidespeed 400;cl_forwardspeed 400;cl_backspeed 400;cl_yawspeed 210;m_pitch 0.022;m_yaw 0.022;cl_bob 0.01;cl_bobcycle 0.8;cl_bobup 0.5;cl_lw 1;cl_lc 1;cl_pitchspeed 225");
  32. set_task(5.0, "Check_Cvar",id,_,_,"b");
  33. }
  34. }
  35. public Player_CmdStart(id, uc_handle)
  36. {
  37. if(is_user_alive(id) && get_pcvar_num(CheckFPS)==1){
  38. UserFPS[id] = floatround(1/(get_uc(uc_handle, UC_Msec) * 0.001));
  39. }
  40. return FMRES_IGNORED;
  41. }
  42.  
  43. public Player_PostThink(id)
  44. {
  45. if(is_user_alive(id) && get_pcvar_num(CheckFPS)==1)
  46. {
  47. if(UserFPS[id] > get_pcvar_num(MaxFps) || UserFPS[id] <= 0)
  48. {
  49. if(++WarFps[id] >= 3)
  50. {
  51. WarFps[id] = 0;
  52. server_cmd("kick #%d ^"%d FPS Detected^"",get_user_userid(id),UserFPS[id])
  53. }
  54. }
  55. else
  56. {
  57. WarFps[id] = 0;
  58. }
  59. }
  60. }
  61.  
  62. public client_disconnect(id)
  63. {
  64. if(task_exists(id)){
  65. remove_task(id)
  66. }
  67. }
  68.  
  69. public Check_Cvar(id)
  70. {
  71. console_cmd(id,"cl_sidespeed 400;cl_forwardspeed 400;cl_backspeed 400;cl_yawspeed 210;m_pitch 0.022;m_yaw 0.022;cl_bob 0.01;cl_bobcycle 0.8;cl_bobup 0.5;cl_lw 1;cl_lc 1;cl_pitchspeed 225");
  72. query_client_cvar(id,"gl_ztrick_old","chsBuild");
  73. query_client_cvar(id,"gl_ztrick","chsBuild1");
  74. for(new i = 0; i < sizeof(g_CheckCvar); i++){
  75. query_client_cvar(id,g_CheckCvar[i],"AllCvar");
  76. }
  77. }
  78.  
  79. public chsBuild(id,const szVar[],const szValue[]){
  80. if( szValue[0] != 'B' ) {
  81. sBuild_new[id]=true;
  82. }
  83. else
  84. {
  85. sBuild_new[id]=false;
  86. }
  87. }
  88.  
  89. public chsBuild1(id,const szVar[],const szValue[]){
  90. if( szValue[0] != 'B' ) {
  91. sBuild_new[id]=false;
  92. }
  93. else
  94. {
  95. sBuild_new[id]=true;
  96. }
  97. }
  98.  
  99. public AllCvar(id,const szVar[],const szValue[])
  100. {
  101. static szName[32],szIP[32];
  102. get_user_name(id, szName, charsmax(szName));
  103. get_user_ip(id, szIP, charsmax(szIP));
  104.  
  105. if((equal(szVar, "cl_forwardspeed") && str_to_float(szValue) != 400)
  106. || (equal(szVar, "cl_sidespeed") && str_to_float(szValue) != 400)
  107. || (equal(szVar, "cl_backspeed") && str_to_float(szValue) != 400))
  108. {
  109. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  110. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 400^"", get_user_userid(id),szVar)
  111. }
  112. if ((equal(szVar, "cl_yawspeed") && str_to_float(szValue) != 210))
  113. {
  114. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  115. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 210^"", get_user_userid(id),szVar)
  116. }
  117. if ((equal(szVar, "developer") && str_to_float(szValue) != 0)
  118. || (equal(szVar, "cl_filterstuffcmd") && str_to_float(szValue) != 0)
  119. || (equal(szVar, "fps_override") && str_to_float(szValue) != 0)
  120. || (equal(szVar, "fps_modem") && str_to_float(szValue) != 0)
  121. || (equal(szVar, "gl_vsync") && str_to_float(szValue) != 0))
  122. {
  123. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  124. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0^"", get_user_userid(id),szVar)
  125. }
  126. if (sBuild_new[id] == false){
  127. if((equal(szVar, "fps_max") && (str_to_float(szValue) < 61 || str_to_float(szValue) > 101)))
  128. {
  129. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  130. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 101^"",get_user_userid(id),szVar);
  131. }
  132. }
  133. if (sBuild_new[id] == true){
  134. if((equal(szVar, "fps_max") && (str_to_float(szValue) < 61 || str_to_float(szValue) > 99.5)))
  135. {
  136. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  137. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 99.5^"",get_user_userid(id),szVar);
  138. }
  139. }
  140. if((equal(szVar, "m_pitch") && str_to_float(szValue) != 0.022)
  141. || (equal(szVar, "m_yaw") && str_to_float(szValue) != 0.022))
  142. {
  143. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  144. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0.022^"",get_user_userid(id),szVar);
  145. }
  146. if ((equal(szVar, "cl_bob") && str_to_float(szValue) != 0.01))
  147. {
  148. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  149. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0.01^"",get_user_userid(id), szVar);
  150. }
  151. if ((equal(szVar, "cl_bobcycle") && str_to_float(szValue) != 0.8))
  152. {
  153. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  154. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0.8^"",get_user_userid(id), szVar);
  155. }
  156. if ((equal(szVar, "cl_bobup") && str_to_float(szValue) != 0.5))
  157. {
  158. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  159. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0.5^"",get_user_userid(id), szVar);
  160. }
  161. if ((equal(szVar, "cl_lw") && str_to_float(szValue) != 1)
  162. || (equal(szVar, "cl_lc") && str_to_float(szValue) != 1))
  163. {
  164. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  165. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 1^"",get_user_userid(id), szVar);
  166. }
  167. if(equal(szVar, "net_graph") && str_to_float(szValue) == 2)
  168. {
  169. new kick_or_write=get_pcvar_num(Netgraph)
  170. if(kick_or_write==1){
  171. console_cmd(id,"net_graph 1");
  172. }
  173. if(kick_or_write==3){
  174. console_cmd(id,"net_graph 3");
  175. }
  176. if(kick_or_write==0){
  177. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0,1,3^"",get_user_userid(id),szVar);
  178. }
  179. }
  180.  
  181. }
Advertisement
Add Comment
Please, Sign In to add comment