HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <engine>
  3. #include <zombieplague>
  4.  
  5. #define PLUGIN "Multiple jumps for the nemesis"
  6. #define VERSION "0.1"
  7. #define AUTHOR "Strax"
  8.  
  9. //#define FOR_ADMINS
  10. #if defined FOR_ADMINS
  11. #define ADMINACCESS ADMIN_LEVEL_B
  12. #endif
  13.  
  14. new Jumpnum[33] = false
  15. new bool:canJump[33] = false
  16. new g_maxjumps
  17.  
  18. public plugin_init()
  19. {
  20. register_plugin(PLUGIN, VERSION, AUTHOR)
  21. }
  22.  
  23. public client_putinserver(id)
  24. {
  25. Jumpnum[id] = 0
  26. canJump[id] = false
  27. }
  28.  
  29. public client_disconnect(id)
  30. {
  31. Jumpnum[id] = 0
  32. canJump[id] = false
  33. }
  34.  
  35. public plugin_precache()
  36. {
  37. g_maxjumps = register_cvar("zp_nemesis_maxjumps", "3")
  38. }
  39.  
  40. public zp_user_humanized_post(player)
  41. {
  42. if (zp_get_user_nemesis(player))
  43. {
  44. canJump[player] = true
  45. Jumpnum[player] = true
  46. }
  47. }
  48.  
  49. public client_PreThink(id)
  50. {
  51. if (!is_user_alive(id) || !zp_get_user_nemesis(id))
  52. return PLUGIN_CONTINUE
  53.  
  54. #if defined FOR_ADMINS
  55. if( !( get_user_flags(id) & ADMINACCESS) )
  56. return PLUGIN_CONTINUE
  57. #endif
  58.  
  59. new nbut = get_user_button(id)
  60. new obut = get_user_oldbutton(id)
  61.  
  62. if (( nbut & IN_JUMP) && !(get_entity_flags(id) & FL_ONGROUND) && !(obut & IN_JUMP))
  63. {
  64. if (Jumpnum[id] < get_pcvar_num(g_maxjumps))
  65. {
  66. canJump[id] = true
  67. Jumpnum[id]++
  68. return PLUGIN_CONTINUE
  69. }
  70.  
  71. }
  72. if ((nbut & IN_JUMP) && (get_entity_flags(id) & FL_ONGROUND))
  73. {
  74. Jumpnum[id] = 0
  75. return PLUGIN_CONTINUE
  76. }
  77. return PLUGIN_CONTINUE
  78. }
  79.  
  80. public client_PostThink(id)
  81. {
  82. if (!is_user_alive(id) || !zp_get_user_nemesis(id))
  83. return PLUGIN_CONTINUE
  84.  
  85. #if defined FOR_ADMINS
  86. if( !( get_user_flags(id) & ADMINACCESS) )
  87. return PLUGIN_CONTINUE
  88. #endif
  89.  
  90. if (canJump[id] == true)
  91. {
  92. new Float:velocity[3]
  93. entity_get_vector(id,EV_VEC_velocity,velocity)
  94. velocity[2] = random_float(265.0,285.0)
  95. entity_set_vector(id,EV_VEC_velocity,velocity)
  96. canJump[id] = false
  97. return PLUGIN_CONTINUE
  98. }
  99. return PLUGIN_CONTINUE
  100. }
  101.