HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. Wallclimb v1.0f by Python1320
  3. Plagued Version 0.22 by Dabbi
  4.  
  5. Allows Poison Zombie to Climb Walls in Zombie Plague [3.62]
  6.  
  7. CVARS: zp_wallclimb 0 = Off / 1 = Hold USE / 2 = Hold JUMP and DUCK (Default 1)
  8. zp_wallclimb_nemesis 0 = Disable wallclimb during nemesis round. / 1 = Enable (Default 1)
  9. zp_wallclimb_survivor 0 = Disable wallclimb during survivor round. / 1 = Enable (Default 0)
  10.  
  11. Changes:
  12. 0.22
  13. Made the function wallclimb return a value.
  14. Put plugin version to a cvar.
  15. 0.21
  16. Added cvars to enable disable wallclimb durin survivor/nemesis round
  17. 0.2
  18. Added cvar to enable / disable Walllclimb Plugin
  19. 0.1
  20. First release.
  21. */
  22.  
  23. #include <amxmodx>
  24. // #include <engine>
  25. #include <fakemeta>
  26.  
  27. #include <cstrike>
  28. #include <zombieplague.inc>
  29.  
  30. //#include <fakemeta_util>
  31. #define STR_T 33
  32.  
  33. // Stuff taken from fakemeta_util
  34. #define fm_get_user_button(%1) pev(%1, pev_button)
  35. /* stock fm_get_user_button(index)
  36. return pev(index, pev_button) */
  37.  
  38. #define fm_get_entity_flags(%1) pev(%1, pev_flags)
  39. /* stock fm_get_entity_flags(index)
  40. return pev(index, pev_flags) */
  41.  
  42. stock fm_set_user_velocity(entity, const Float:vector[3]) {
  43. set_pev(entity, pev_velocity, vector);
  44.  
  45. return 1;
  46. }
  47. //End of stuff from fakemeta_util
  48. //new STR_T[32]
  49. new bool:g_WallClimb[33]
  50. new Float:g_wallorigin[32][3]
  51. new cvar_zp_wallclimb, cvar_zp_wallclimb_nemesis, cvar_zp_wallclimb_survivor
  52. new g_zclass_climb
  53.  
  54. // Climb Zombie Atributes
  55. new const zclass_name[] = { "Falmaszo Zombi" } // name
  56. new const zclass_info[] = { "HP- Gyorsasag+ Ugras+ Visszalokes+" } // description
  57. new const zclass_model[] = { "zombie_source" } // model
  58. new const zclass_clawmodel[] = { "v_knife_zombie.mdl" } // claw model
  59. const zclass_health = 2500 // health
  60. const zclass_speed = 250 // speed
  61. const Float:zclass_gravity = 0.75 // gravity
  62. const Float:zclass_knockback = 1.25 // knockback
  63.  
  64. public plugin_init()
  65. {
  66. register_plugin("[ZP] Wallclimb ", "1.0", "WallClimb by Python1320/Cheap_Suit, Plagued by Dabbi")
  67. register_forward(FM_Touch, "fwd_touch")
  68. register_forward(FM_PlayerPreThink, "fwd_playerprethink")
  69. //register_forward(FM_PlayerPostThink, "fwd_playerpostthink")
  70. register_event("DeathMsg","EventDeathMsg","a")
  71. //register_cvar("zp_wallclimb_version", PLUGIN_VERSION, FCVAR_SERVER|FCVAR_SPONLY)
  72. cvar_zp_wallclimb = register_cvar("zp_wallclimb", "1")
  73. cvar_zp_wallclimb_survivor = register_cvar("zp_wallclimb_survivor", "0")
  74. cvar_zp_wallclimb_nemesis = register_cvar("zp_wallclimb_nemesis", "1")
  75.  
  76. }
  77.  
  78. public plugin_precache()
  79. {
  80. g_zclass_climb = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
  81. }
  82.  
  83. public EventDeathMsg()
  84. {
  85. new id = read_data(2)
  86. g_WallClimb[id] = true
  87. return PLUGIN_HANDLED
  88. }
  89.  
  90. public client_connect(id) {
  91. g_WallClimb[id] = true
  92. }
  93.  
  94. public fwd_touch(id, world)
  95. {
  96. if(!is_user_alive(id) || !g_WallClimb[id] || !pev_valid(id))
  97. return FMRES_IGNORED
  98.  
  99. new player = STR_T
  100. if (!player)
  101. return FMRES_IGNORED
  102.  
  103. new classname[STR_T]
  104. pev(world, pev_classname, classname, (STR_T))
  105.  
  106. if(equal(classname, "worldspawn") || equal(classname, "func_wall") || equal(classname, "func_breakable"))
  107. pev(id, pev_origin, g_wallorigin[id])
  108.  
  109. return FMRES_IGNORED
  110. }
  111.  
  112. public wallclimb(id, button)
  113. {
  114. static Float:origin[3]
  115. pev(id, pev_origin, origin)
  116.  
  117. if(get_distance_f(origin, g_wallorigin[id]) > 25.0)
  118. return FMRES_IGNORED // if not near wall
  119.  
  120. if(fm_get_entity_flags(id) & FL_ONGROUND)
  121. return FMRES_IGNORED
  122.  
  123. if(button & IN_FORWARD)
  124. {
  125. static Float:velocity[3]
  126. velocity_by_aim(id, 120, velocity)
  127. fm_set_user_velocity(id, velocity)
  128. }
  129. else if(button & IN_BACK)
  130. {
  131. static Float:velocity[3]
  132. velocity_by_aim(id, -120, velocity)
  133. fm_set_user_velocity(id, velocity)
  134. }
  135. return FMRES_IGNORED
  136. }
  137.  
  138. public fwd_playerprethink(id)
  139. {
  140. if(!g_WallClimb[id] || !zp_get_user_zombie(id))
  141. return FMRES_IGNORED
  142.  
  143. if(zp_is_survivor_round() && get_pcvar_num(cvar_zp_wallclimb_survivor) == 0)
  144. return FMRES_IGNORED
  145.  
  146. if(zp_is_nemesis_round() && get_pcvar_num(cvar_zp_wallclimb_nemesis) == 0)
  147. return FMRES_IGNORED
  148.  
  149. new button = fm_get_user_button(id)
  150.  
  151. if((get_pcvar_num(cvar_zp_wallclimb) == 1) && (button & IN_USE) && (zp_get_user_zombie_class(id) == g_zclass_climb)) //Use button = climb
  152. wallclimb(id, button)
  153. else if((get_pcvar_num(cvar_zp_wallclimb) == 2) && (button & IN_JUMP) && button & IN_DUCK && (zp_get_user_zombie_class(id) == g_zclass_climb)) //Jump + Duck = climb
  154. wallclimb(id, button)
  155.  
  156. return FMRES_IGNORED
  157. }
  158.