Advertisement
Guest User

Untitled

a guest
Sep 6th, 2020
42
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.43 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <hamsandwich>
  4. #define DEVELOPER_OFFSET 768
  5. #define MAXWARNS 3
  6. #define is_user_valid(%1) (1 <= %1 <= 32)
  7. new cvar_MaxFps;
  8. new iFrames[33]
  9. new iWarnings[33]
  10. new alive[33]
  11. public plugin_init()
  12. {
  13. register_plugin("Anti-developer", "1.0", "NeuTroN aka Menethil")
  14. register_forward(FM_PlayerPreThink, "Fwd_PlayerPreThink")
  15. cvar_MaxFps = register_cvar("amx_maxfps", "130")
  16. register_event( "DeathMsg", "eventDeath", "a" )
  17. RegisterHam(Ham_Spawn,"player","playerSpawn")
  18. }
  19.  
  20. public Fwd_PlayerPreThink(id)
  21. {
  22. if(!alive[id])
  23. return FMRES_IGNORED
  24. iFrames[id]++
  25. return FMRES_IGNORED
  26. }
  27.  
  28.  
  29. public client_putinserver(id)
  30. {
  31. iFrames[id] = 0
  32. set_task(1.0, "ShowFps",id+DEVELOPER_OFFSET, _, _, "b");
  33. }
  34.  
  35. public ShowFps(id)
  36. {
  37. id-=DEVELOPER_OFFSET
  38. if(is_user_alive(id) && iFrames[id] >= get_pcvar_num(cvar_MaxFps))
  39. {
  40. iWarnings[id]++
  41. if(iWarnings[id] >= MAXWARNS)
  42. {
  43. new name[32]
  44. get_user_name(id,name,31)
  45.  
  46. user_kill(id)
  47. client_print(0, print_chat, " %s slayed for using more fps than allowed(100)",name)
  48. }
  49. }
  50. iFrames[id] = 0
  51. }
  52.  
  53. public client_disconnect(id)
  54. {
  55. if(task_exists(id+DEVELOPER_OFFSET))
  56. {
  57. remove_task(id+DEVELOPER_OFFSET)
  58. }
  59. }
  60.  
  61. public playerSpawn(id)
  62. {
  63. alive[id] = 1
  64. return PLUGIN_CONTINUE
  65. }
  66.  
  67. public eventDeath()
  68. {
  69. new victim = read_data(2)
  70. if(is_user_valid(victim))
  71. {
  72. alive[victim] = 0
  73. }
  74. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement