HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <zombieplague>
  3. #include <engine>
  4. #include <fun>
  5. #include <fakemeta>
  6. #include <hamsandwich>
  7.  
  8. #define ID_FURY (taskid - TASK_FURY)
  9.  
  10. // Task offsets
  11. enum (+= 100)
  12. {
  13. TASK_FURY
  14. }
  15.  
  16. /*================================================================================
  17.  [Customizations]
  18. =================================================================================*/
  19.  
  20. // Zombie Attributes
  21. new const zclass10_name[] = { "Cerberus Kutya"}
  22. new const zclass10_info[] = { "Atmegy a lezeren [5mpig]" }
  23. new const zclass10_model[] = { "Cerberus_frk_14" }
  24. new const zclass10_clawmodel[] = { "v_doghands1.mdl" }
  25.  
  26. const zclass10_health = 1500
  27. const zclass10_speed = 275
  28.  
  29. const Float:zclass10_gravity = 0.8
  30. const Float:zclass10_knockback = 0.5
  31.  
  32. new const idle[] = "zombie_plague/cerberus_idle.wav"
  33. new const fury[] = "zombie_plague/cerberus_fury.wav"
  34. new const normaly[] = "zombie_plague/cerberus_normaly.wav"
  35.  
  36. /*================================================================================
  37.  Customization ends here!
  38.  Any edits will be your responsibility
  39. =================================================================================*/
  40.  
  41. // Plugin info.
  42. #define PLUGIN "[ZP] Zombie Class: Cerberus Dog"
  43. #define VERSION "0.1"
  44. #define AUTHOR "DJHD!"
  45.  
  46. // Variables
  47. new g_cerberus, g_veces[33], i_fury_time[33], g_maxplayers
  48.  
  49. // Cvar Pointers
  50. new cvar_fury, cvar_furytime
  51.  
  52. /*================================================================================
  53.  [Init, CFG and Precache]
  54. =================================================================================*/
  55.  
  56. public plugin_init()
  57. {
  58. register_plugin(PLUGIN, VERSION, AUTHOR)
  59.  
  60. cvar_fury = register_cvar("zp_cerberus_fury", "1")
  61. cvar_furytime = register_cvar("zp_cerberus_fury_time", "10.0")
  62.  
  63. static szCvar[30]
  64. formatex(szCvar, charsmax(szCvar), "v%s by %s", VERSION, AUTHOR)
  65. register_cvar("zp_zclass_cerberus", szCvar, FCVAR_SERVER|FCVAR_SPONLY)
  66.  
  67. register_logevent("roundStart", 2, "1=Round_Start")
  68. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
  69.  
  70. g_maxplayers = get_maxplayers()
  71. }
  72.  
  73. public plugin_precache()
  74. {
  75. g_cerberus = zp_register_zombie_class(zclass10_name, zclass10_info, zclass10_model, zclass10_clawmodel, zclass10_health, zclass10_speed, zclass10_gravity, zclass10_knockback)
  76.  
  77. precache_sound(idle)
  78. precache_sound(fury)
  79. precache_sound(normaly)
  80. }
  81.  
  82. /*================================================================================
  83.  [Zombie Plague Forwards]
  84. =================================================================================*/
  85.  
  86. public zp_user_infected_post(id, infector)
  87. {
  88. if (zp_get_user_zombie_class(id) == g_cerberus)
  89. {
  90. client_print(id, print_chat, "[ZP] Atmehetsz a lezeren %d betu - ^"E^"", get_pcvar_num(cvar_fury))
  91.  
  92. g_veces[id] = get_pcvar_num(cvar_fury)
  93. i_fury_time[id] = get_pcvar_num(cvar_furytime)
  94. emit_sound(id, CHAN_STREAM, idle, 1.0, ATTN_NORM, 0, PITCH_HIGH)
  95. remove_task(id)
  96. }
  97. }
  98.  
  99. public zp_user_humanized_post(taskid)
  100. {
  101. new id = ID_FURY
  102. remove_task(id+TASK_FURY)
  103. set_user_godmode(id, 0)
  104. }
  105.  
  106.  
  107. /*================================================================================
  108.  [Main Forwards]
  109. =================================================================================*/
  110.  
  111. public fw_PlayerPreThink(id)
  112. {
  113. if (!is_user_alive(id))
  114. return FMRES_IGNORED
  115.  
  116. new button = get_user_button(id)
  117. new oldbutton = get_user_oldbutton(id)
  118.  
  119. if (zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_cerberus))
  120. {
  121. if (!(oldbutton & IN_USE) && (button & IN_USE))
  122. clcmd_furia(id)
  123. }
  124.  
  125. return PLUGIN_CONTINUE
  126. }
  127.  
  128. /*================================================================================
  129.  [Internal Functions]
  130. =================================================================================*/
  131.  
  132. public clcmd_furia(taskid)
  133. {
  134. new id = ID_FURY
  135.  
  136. if(!is_user_alive(id) || !is_user_connected(id)|| !zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_zombie_class(id) != g_cerberus)
  137. return PLUGIN_HANDLED
  138.  
  139. if(g_veces[id] > 0)
  140. {
  141. g_veces[id] = g_veces[id] -1
  142.  
  143. set_task(0.1, "effects", id+TASK_FURY, _, _, "b")
  144. i_fury_time[id] = get_pcvar_num(cvar_furytime)
  145.  
  146. set_task(1.0, "ShowHUD", id+TASK_FURY, _, _, "a", i_fury_time[id])
  147.  
  148. emit_sound(id, CHAN_STREAM, fury, 1.0, ATTN_NORM, 0, PITCH_HIGH)
  149. }
  150. else
  151. {
  152. client_print(id, print_chat, "[ZP] Mar nem mehetsz at a lezeren.")
  153. return PLUGIN_HANDLED
  154. }
  155.  
  156. return PLUGIN_HANDLED
  157. }
  158.  
  159. public effects(id)
  160. {
  161. if(!is_user_alive(id) || !is_user_connected(id)|| !zp_get_user_zombie(id) || zp_get_user_nemesis(id) || zp_get_user_zombie_class(id) != g_cerberus)
  162. return
  163.  
  164. static origin[3]
  165. get_user_origin(id, origin)
  166.  
  167. message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
  168. write_byte(TE_PARTICLEBURST) // TE id
  169. write_coord(origin[0]) // x
  170. write_coord(origin[1]) // y
  171. write_coord(origin[2]) // z
  172. write_short(130) // radius
  173. write_byte(70) // color
  174. write_byte(3) // duration (will be randomized a bit)
  175. message_end()
  176.  
  177. message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
  178. write_byte(TE_DLIGHT) // TE id
  179. write_coord(origin[0]) // x
  180. write_coord(origin[1]) // y
  181. write_coord(origin[2]) // z
  182. write_byte(22) // radius
  183. write_byte(255) // r
  184. write_byte(0) // g
  185. write_byte(30) // b
  186. write_byte(2) // life
  187. write_byte(0) // decay rate
  188. message_end()
  189.  
  190. set_user_godmode(id, 1)
  191.  
  192. set_task(get_pcvar_float(cvar_furytime), "remove_fury", id)
  193. }
  194.  
  195. public ShowHUD(id)
  196. {
  197. if(is_user_alive(id))
  198. {
  199. i_fury_time[id] = i_fury_time[id] - 1;
  200. set_hudmessage(200, 100, 0, -1.0, -0.46, 0, 1.0, 1.1, 0.0, 0.0, -1)
  201. show_hudmessage(id, "Duh: %d", i_fury_time[id]+1)
  202. }
  203. else
  204. {
  205. remove_task(id+TASK_FURY)
  206. }
  207. }
  208.  
  209. public remove_fury(taskid)
  210. {
  211. new id = ID_FURY
  212.  
  213. remove_task(id+TASK_FURY)
  214.  
  215. set_user_godmode(id, 0)
  216. emit_sound(id, CHAN_STREAM, normaly, 1.0, ATTN_NORM, 0, PITCH_HIGH)
  217. }
  218.  
  219. public roundStart()
  220. {
  221. for(new i = 1; i <= g_maxplayers; i++)
  222. {
  223. i_fury_time[i] = get_pcvar_num(cvar_furytime)
  224. remove_task(i)
  225. }
  226. }