Advertisement
Guest User

Untitled

a guest
Apr 20th, 2014
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.77 KB | None | 0 0
  1. /*================================================================================
  2.  
  3. -----------------------------------
  4. -*- [ZP] Class : BunnyHop Zombie -*-
  5. -----------------------------------
  6.  
  7. ~~~~~~~~~~~~~~~
  8. - Description -
  9. ~~~~~~~~~~~~~~~
  10.  
  11. Able to BunnyHop.
  12.  
  13. ================================================================================*/
  14. #include <amxmodx>
  15. #include <fakemeta>
  16. #include <zombieplague>
  17. #include <zombiexp>
  18.  
  19. new g_zclass_bhzombie
  20.  
  21. new g_hasBhop[ 33 ]
  22. new pcvar_enabled, pcvar_autojump
  23.  
  24. new bool:g_restorevel[33]
  25. new Float:g_velocity[33][3]
  26.  
  27. new const zclass_name[] = { "Zombie Esqueleto" }
  28. new const zclass_info[] = { "Hace Bunny" }
  29. new const zclass_model[] = { "zombie_source" }
  30. new const zclass_clawmodel[] = { "v_knife_zombie.mdl" }
  31. const zclass_health = 3500
  32. const zclass_speed = 250
  33. const Float:zclass_gravity = 0.9
  34. const Float:zclass_knockback = 0.0
  35. const zclass_level = 65
  36.  
  37. public plugin_init()
  38. {
  39. register_plugin("[ZP] Class : BunnyHop Zombie", "1.1", "ƒa†es™")
  40.  
  41. register_event( "DeathMsg", "event_player_death", "a" )
  42.  
  43. pcvar_enabled = register_cvar( "zp_bhzombie_bunnyhop_enabled", "1" )
  44. pcvar_autojump = register_cvar( "zp_bhzombie_autojump", "1" )
  45.  
  46. register_forward( FM_PlayerPreThink, "forward_prethink" )
  47. }
  48.  
  49. public plugin_precache()
  50. {
  51. g_zclass_bhzombie = zpxp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback, zclass_level)
  52.  
  53. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
  54. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink_Post", 1)
  55. }
  56.  
  57. public zp_user_infected_post(id, infector)
  58. {
  59. if (zp_get_user_zombie_class(id) == g_zclass_bhzombie)
  60. {
  61. g_hasBhop[ id ] = true
  62.  
  63. pev(id, pev_velocity, g_velocity[id])
  64. }
  65. }
  66.  
  67. public client_connect( id )
  68. {
  69. g_hasBhop[ id ] = false
  70. }
  71.  
  72. public event_player_death()
  73. {
  74. g_hasBhop[ read_data( 2 ) ] = false
  75. }
  76.  
  77. public forward_prethink( id )
  78. {
  79. if(!is_user_alive(id) || !zp_get_user_zombie(id))
  80. return PLUGIN_CONTINUE
  81.  
  82. if (zp_get_user_zombie_class(id) != g_zclass_bhzombie)
  83. return PLUGIN_CONTINUE
  84.  
  85. if( get_pcvar_num( pcvar_enabled ) )
  86. {
  87. set_pev( id, pev_fuser2, 0.0 )
  88.  
  89. if( get_pcvar_num( pcvar_autojump ) && pev( id, pev_button ) & IN_JUMP )
  90. {
  91. new szFlags = pev( id, pev_flags )
  92. if( !( szFlags & FL_WATERJUMP ) && pev( id, pev_waterlevel ) < 2 && szFlags & FL_ONGROUND )
  93. {
  94. new Float: szVelocity[ 3 ]
  95. pev( id, pev_velocity, szVelocity)
  96. szVelocity[ 2 ] += 250.0
  97. set_pev( id, pev_velocity, szVelocity )
  98. set_pev( id, pev_gaitsequence, 6 )
  99. }
  100. }
  101. }
  102. return FMRES_IGNORED
  103. }
  104.  
  105. public fw_PlayerPreThink(id)
  106. {
  107. if ( !is_user_alive(id) || !is_user_bot(id) || !zp_get_user_zombie(id) )
  108. return FMRES_IGNORED
  109.  
  110. if (zp_get_user_zombie_class(id) != g_zclass_bhzombie)
  111. return FMRES_IGNORED
  112.  
  113. if (pev(id, pev_flags) & FL_ONGROUND)
  114. {
  115. pev(id, pev_velocity, g_velocity[id])
  116.  
  117. g_restorevel[id] = true
  118. }
  119. return FMRES_IGNORED
  120. }
  121.  
  122. public fw_PlayerPreThink_Post(id)
  123. {
  124. if (zp_get_user_zombie_class(id) != g_zclass_bhzombie)
  125. return FMRES_IGNORED
  126.  
  127. if (g_restorevel[id])
  128. {
  129. g_restorevel[id] = false
  130.  
  131. if (!(pev(id, pev_flags) & FL_ONTRAIN))
  132. {
  133. new groundent = pev(id, pev_groundentity)
  134.  
  135. if (pev_valid(groundent) && (pev(groundent, pev_flags) & FL_CONVEYOR))
  136. {
  137. static Float:vecTemp[3]
  138.  
  139. pev(id, pev_basevelocity, vecTemp)
  140.  
  141. g_velocity[id][0] += vecTemp[0]
  142. g_velocity[id][1] += vecTemp[1]
  143. g_velocity[id][2] += vecTemp[2]
  144. }
  145.  
  146. set_pev(id, pev_velocity, g_velocity[id])
  147.  
  148. return FMRES_HANDLED
  149. }
  150. }
  151. return FMRES_IGNORED
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement