seroff

FPS Hack Detector 1.0 By (Mistrick + Seroff)

Jun 24th, 2016
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.30 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta>
  3.  
  4. #define PLUGIN "FPS Hack Detector"
  5. #define VERSION "1.0"
  6. #define AUTHOR "Mistrick + Seroff"
  7.  
  8. new g_iFPS[33], g_iFrame[33], g_iMaxPlayers;
  9.  
  10. public plugin_init()
  11. {
  12. register_plugin(PLUGIN, VERSION, AUTHOR);
  13. register_forward(FM_PlayerPostThink, "FM_PlayerPostThink_Pre", 0);
  14. register_forward(FM_PlayerPostThink, "FM_PlayerPostThink_Post", 1);
  15. set_task(1.0, "CheckFps", _, _, _, "b");
  16. g_iMaxPlayers = get_maxplayers();
  17. }
  18.  
  19. public client_putinserver(id){
  20. g_iFPS[id]=0;
  21. }
  22.  
  23. public FM_PlayerPostThink_Pre(id)
  24. {
  25. if(!is_user_alive(id)) return FMRES_IGNORED;
  26. g_iFrame[id] += 1;
  27. return FMRES_IGNORED;
  28. }
  29.  
  30. public FM_PlayerPostThink_Post(id)
  31. {
  32. if(!is_user_alive(id)) return FMRES_IGNORED;
  33. new fps=g_iFPS[id]-5;
  34. if( fps > 101 || fps < -5){
  35. server_cmd("kick #%d ^"FPS Hack Detected!^"",get_user_userid(id));
  36. log_to_file("addons/amxmodx/logs/fpshack.log","Player: %s FPS: [%d]",get_name(id),fps);
  37. }
  38. return FMRES_IGNORED;
  39. }
  40.  
  41. public CheckFps()
  42. {
  43. static id;
  44. for(id = 1; id <= g_iMaxPlayers; id++)
  45. {
  46. if(!is_user_alive(id)) continue;
  47. g_iFPS[id] = g_iFrame[id];
  48. g_iFrame[id] = 0;
  49. }
  50. }
  51.  
  52. stock get_name(id){
  53. new Name[33];
  54. get_user_name(id,Name,charsmax(Name));
  55. return Name;
  56. }
Add Comment
Please, Sign In to add comment