seroff

Anti-Cheat (Cvar | FPS) 2.6 Seroff

Dec 27th, 2015
287
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.69 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.6","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.  
  29. public client_putinserver(id)
  30. {
  31. if(get_pcvar_num(CheckCVAR)==1){
  32. set_task(0.1,"client_build",id)
  33. SendCmd(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");
  34. set_task(1.0, "fps_set",id);
  35. set_task(5.0, "Check_Cvar",id,_,_,"b");
  36. }
  37. }
  38.  
  39. public fps_set(id){
  40. if(sBuild_new[id]==true){
  41. SendCmd(id,"fps_max 99.5")
  42. }
  43. if(sBuild_new[id]==false){
  44. SendCmd(id,"fps_max 101")
  45. }
  46. }
  47.  
  48. public client_build(id){
  49. query_client_cvar(id,"gl_ztrick_old","chsBuild");
  50. query_client_cvar(id,"gl_ztrick","chsBuild1");
  51. }
  52.  
  53. public chsBuild(id,const szVar[],const szValue[]){
  54. if( szValue[0] != 'B' ) {
  55. sBuild_new[id]=true;
  56. }
  57. else
  58. {
  59. sBuild_new[id]=false;
  60. }
  61. }
  62.  
  63. public chsBuild1(id,const szVar[],const szValue[]){
  64. if( szValue[0] != 'B' ) {
  65. sBuild_new[id]=false;
  66. }
  67. else
  68. {
  69. sBuild_new[id]=true;
  70. }
  71. }
  72.  
  73. public client_disconnect(id)
  74. {
  75. if(task_exists(id)){
  76. remove_task(id)
  77. }
  78. }
  79.  
  80.  
  81. public Player_CmdStart(id, uc_handle)
  82. {
  83. if(is_user_alive(id) && get_pcvar_num(CheckFPS)==1){
  84. UserFPS[id] = floatround(1/(get_uc(uc_handle, UC_Msec) * 0.001));
  85. }
  86. return FMRES_IGNORED;
  87. }
  88.  
  89. public Player_PostThink(id)
  90. {
  91. if(is_user_alive(id) && get_pcvar_num(CheckFPS)==1)
  92. {
  93. if(UserFPS[id] > get_pcvar_num(MaxFps) || UserFPS[id] <= 0)
  94. {
  95. if(++WarFps[id] >= 3)
  96. {
  97. WarFps[id] = 0;
  98. server_cmd("kick #%d ^"%d FPS Detected^"",get_user_userid(id),UserFPS[id])
  99. }
  100. }
  101. else
  102. {
  103. WarFps[id] = 0;
  104. }
  105. }
  106. }
  107.  
  108. public Check_Cvar(id)
  109. {
  110. SendCmd(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");
  111. for(new i = 0; i < sizeof(g_CheckCvar); i++){
  112. query_client_cvar(id,g_CheckCvar[i],"AllCvar");
  113. }
  114. }
  115.  
  116. public AllCvar(id,const szVar[],const szValue[])
  117. {
  118. static szName[32],szIP[32];
  119. get_user_name(id, szName, charsmax(szName));
  120. get_user_ip(id, szIP, charsmax(szIP));
  121.  
  122. if((equal(szVar, "cl_forwardspeed") && str_to_float(szValue) != 400)
  123. || (equal(szVar, "cl_sidespeed") && str_to_float(szValue) != 400)
  124. || (equal(szVar, "cl_backspeed") && str_to_float(szValue) != 400))
  125. {
  126. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  127. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 400^"", get_user_userid(id),szVar)
  128. }
  129. if ((equal(szVar, "cl_yawspeed") && str_to_float(szValue) != 210))
  130. {
  131. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  132. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 210^"", get_user_userid(id),szVar)
  133. }
  134. if ((equal(szVar, "developer") && str_to_float(szValue) != 0)
  135. || (equal(szVar, "cl_filterstuffcmd") && str_to_float(szValue) != 0)
  136. || (equal(szVar, "fps_override") && str_to_float(szValue) != 0)
  137. || (equal(szVar, "fps_modem") && str_to_float(szValue) != 0)
  138. || (equal(szVar, "gl_vsync") && str_to_float(szValue) != 0))
  139. {
  140. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  141. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0^"", get_user_userid(id),szVar)
  142. }
  143. if (sBuild_new[id] == false){
  144. if((equal(szVar, "fps_max") && (str_to_float(szValue) < 61 || str_to_float(szValue) > 101)))
  145. {
  146. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  147. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 101^"",get_user_userid(id),szVar);
  148. }
  149. }
  150. if (sBuild_new[id] == true){
  151. if((equal(szVar, "fps_max") && (str_to_float(szValue) < 61 || str_to_float(szValue) > 99.5)))
  152. {
  153. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  154. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 99.5^"",get_user_userid(id),szVar);
  155. }
  156. }
  157. if((equal(szVar, "m_pitch") && str_to_float(szValue) != 0.022)
  158. || (equal(szVar, "m_yaw") && str_to_float(szValue) != 0.022))
  159. {
  160. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  161. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0.022^"",get_user_userid(id),szVar);
  162. }
  163. if ((equal(szVar, "cl_bob") && str_to_float(szValue) != 0.01))
  164. {
  165. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  166. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0.01^"",get_user_userid(id), szVar);
  167. }
  168. if ((equal(szVar, "cl_bobcycle") && str_to_float(szValue) != 0.8))
  169. {
  170. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  171. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0.8^"",get_user_userid(id), szVar);
  172. }
  173. if ((equal(szVar, "cl_bobup") && str_to_float(szValue) != 0.5))
  174. {
  175. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  176. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0.5^"",get_user_userid(id), szVar);
  177. }
  178. if ((equal(szVar, "cl_lw") && str_to_float(szValue) != 1)
  179. || (equal(szVar, "cl_lc") && str_to_float(szValue) != 1))
  180. {
  181. ColorChat(0,NORMAL,"[^3Анти-Чит^1]Игрок ^4%s ^1Использует ^1[^4%s %s^1]",szName,szVar,szValue);
  182. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 1^"",get_user_userid(id), szVar);
  183. }
  184. if(equal(szVar, "net_graph") && str_to_float(szValue) == 2)
  185. {
  186. new kick_or_write=get_pcvar_num(Netgraph)
  187. if(kick_or_write==1){
  188. SendCmd(id,"net_graph 1");
  189. }
  190. if(kick_or_write==3){
  191. SendCmd(id,"net_graph 3");
  192. }
  193. if(kick_or_write==0){
  194. server_cmd("kick #%d ^"Пожалуйста Пропишите В Консоль %s 0,1,3^"",get_user_userid(id),szVar);
  195. }
  196. }
  197. }
  198.  
  199. stock SendCmd( id , text[] ) {
  200. message_begin( MSG_ONE, 51, _, id )
  201. write_byte( strlen(text) + 2 )
  202. write_byte( 10 )
  203. write_string( text )
  204. message_end()
  205. }
Advertisement
Add Comment
Please, Sign In to add comment