Advertisement
mihay111

zpclassfleshpound

Aug 10th, 2019
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.25 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <fakemeta>
  3. #include <fun>
  4. #include <hamsandwich>
  5. #include <cstrike>
  6. #include <zombieplague>
  7.  
  8. // Task offsets
  9. enum (+= 100) {
  10. TASK_AURA
  11. }
  12.  
  13. #define ID_AURA (taskid - TASK_AURA)
  14.  
  15. // Fleshpound Zombie
  16. new const zclass_name[] = { "Zombie Fleshpound" }
  17. new const zclass_info[] = { ">> Have Rage <<" }
  18. new const zclass_model[] = { "Fleshpound" }
  19. new const zclass_clawmodel[] = { "v_fleshpound_claws.mdl" }
  20. const zclass_health = 2100
  21. const zclass_speed = 190
  22. const Float:zclass_gravity = 1.0
  23. const Float:zclass_knockback = 1.0
  24.  
  25. new g_Rage[] = "zombie_plague/fleshpound_rage.wav"
  26.  
  27. // Cooldown hook
  28. new Float:g_iLastFury[33]
  29.  
  30. new g_speed[33]
  31. new r, g, b
  32. new g_maxplayers
  33.  
  34. new cvar_fury_cooldown
  35. new g_KfFleshpound
  36.  
  37. public plugin_init()
  38. {
  39. register_plugin("[ZP] ZP Class: Zombie Fleshpound", "0.1", "DJHD!")
  40.  
  41. cvar_fury_cooldown = register_cvar("zp_fleshpound_cooldown", "15.0")
  42.  
  43. RegisterHam(Ham_Spawn, "player", "fw_PlayerSpawn_Post", 1)
  44. register_forward(FM_PlayerPreThink, "fw_PlayerPreThink")
  45. register_forward(FM_PlayerPreThink, "client_prethink")
  46.  
  47. register_logevent("roundStart", 2, "1=Round_Start")
  48.  
  49. g_maxplayers = get_maxplayers()
  50. }
  51.  
  52. public plugin_precache()
  53. {
  54. g_KfFleshpound = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
  55.  
  56. precache_sound(g_Rage)
  57. }
  58.  
  59. public zp_user_infected_post(id, infector)
  60. {
  61. if (zp_get_user_zombie_class(id) == g_KfFleshpound)
  62. {
  63. if(zp_get_user_nemesis(id))
  64. return
  65.  
  66. print_chatColor(id, "\g[ZP]\n To use your rage press \g^"E^"\n.")
  67.  
  68. r = 255
  69. g = 255
  70. b = 0
  71.  
  72. set_task(0.1, "fleshpound_aura", id+TASK_AURA, _, _, "b")
  73. }
  74. }
  75.  
  76. public zp_user_humanized_post(id)
  77. {
  78. remove_task(id+TASK_AURA)
  79. g_speed[id] = 0
  80. }
  81.  
  82. public client_disconnect(id)
  83. remove_task(id+TASK_AURA)
  84.  
  85. // Ham Player Spawn Post Forward
  86. public fw_PlayerSpawn_Post(id)
  87. {
  88. // Not alive or didn't join a team yet
  89. if (!is_user_alive(id) || !cs_get_user_team(id))
  90. return;
  91.  
  92. // Remove previous tasks
  93. remove_task(id+TASK_AURA)
  94. }
  95.  
  96. public fw_PlayerPreThink(id)
  97. {
  98. if(!is_user_alive(id))
  99. return;
  100.  
  101. static iButton; iButton = pev(id, pev_button)
  102. static iOldButton; iOldButton = pev(id, pev_oldbuttons)
  103.  
  104. if(zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_KfFleshpound) && !zp_get_user_nemesis(id))
  105. {
  106. if((iButton & IN_USE) && !(iOldButton & IN_USE))
  107. MakeRage(id)
  108. }
  109. }
  110.  
  111. public MakeRage(id)
  112. {
  113. if(get_gametime() - g_iLastFury[id] < get_pcvar_float(cvar_fury_cooldown))
  114. {
  115. print_chatColor(id, "\g[ZP]\n Wait \g%.1f\n seconds, to return to rage.", get_pcvar_float(cvar_fury_cooldown)-(get_gametime() - g_iLastFury[id]))
  116. return PLUGIN_HANDLED
  117. }
  118.  
  119. g_iLastFury[id] = get_gametime()
  120.  
  121. r = 255
  122. g = 0
  123. b = 0
  124.  
  125. g_speed[id] = 1
  126. emit_sound(id, CHAN_STREAM, g_Rage, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  127.  
  128. set_task(5.0, "normal", id)
  129.  
  130. return PLUGIN_HANDLED
  131. }
  132.  
  133.  
  134. public normal(id)
  135. {
  136. r = 255
  137. g = 255
  138. b = 0
  139.  
  140. g_speed[id] = 0
  141.  
  142. print_chatColor(id, "\g[ZP]\n You're back to normal.")
  143. }
  144.  
  145. public client_prethink(id)
  146. {
  147. if (zp_get_user_zombie_class(id) == g_KfFleshpound)
  148. {
  149. if(is_user_alive(id) && zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_KfFleshpound) && !zp_get_user_nemesis(id))
  150. Action(id)
  151. }
  152. }
  153.  
  154. public Action(id)
  155. {
  156. if(g_speed[id] == 1)
  157. {
  158. set_pev(id, pev_maxspeed, 650.0)
  159. }
  160. else if(g_speed[id] == 0)
  161. {
  162. set_pev(id, pev_maxspeed, 190.0)
  163. }
  164.  
  165. return PLUGIN_HANDLED;
  166. }
  167.  
  168. // Fleshpound aura task
  169. public fleshpound_aura(taskid)
  170. {
  171. if(!is_user_alive(ID_AURA))
  172. {
  173. // Task not needed anymore
  174. remove_task(taskid);
  175. return;
  176. }
  177.  
  178. if(zp_get_user_nemesis(ID_AURA))
  179. {
  180. // Task not needed anymore
  181. remove_task(taskid);
  182. return;
  183. }
  184.  
  185. // Set aura for fleshpound
  186. if (zp_get_user_zombie_class(ID_AURA) == g_KfFleshpound)
  187. {
  188. // Get player's origin
  189. static origin[3]
  190. get_user_origin(ID_AURA, origin)
  191.  
  192. // Colored Aura
  193. message_begin(MSG_PVS, SVC_TEMPENTITY, origin)
  194. write_byte(TE_DLIGHT) // TE id
  195. write_coord(origin[0]) // x
  196. write_coord(origin[1]) // y
  197. write_coord(origin[2]) // z
  198. write_byte(13) // radius
  199. write_byte(r) // r
  200. write_byte(g) // g
  201. write_byte(b) // b
  202. write_byte(1) // life
  203. write_byte(0) // decay rate
  204. message_end()
  205. }
  206. else
  207. {
  208. // Task not needed anymore
  209. remove_task(taskid);
  210. return;
  211. }
  212. }
  213.  
  214. public roundStart()
  215. {
  216. for (new i = 1; i <= g_maxplayers; i++)
  217. {
  218. remove_task(i+TASK_AURA)
  219. g_speed[i] = 0
  220. }
  221. }
  222.  
  223. stock print_chatColor(const id,const input[], any:...)
  224. {
  225. new msg[191], players[32], count = 1;
  226. vformat(msg,190,input,3);
  227. replace_all(msg,190,"\g","^4");// green
  228. replace_all(msg,190,"\n","^1");// normal
  229. replace_all(msg,190,"\t","^3");// team
  230.  
  231. if (id) players[0] = id; else get_players(players,count,"ch");
  232. for (new i=0;i<count;i++)
  233. if (is_user_connected(players[i]))
  234. {
  235. message_begin(MSG_ONE_UNRELIABLE,get_user_msgid("SayText"),_,players[i]);
  236. write_byte(players[i]);
  237. write_string(msg);
  238. message_end();
  239. }
  240. }
  241. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  242. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
  243. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement