HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fun>
  4. #include <fakemeta>
  5. #include <zombieplague>
  6. #include <hamsandwich>
  7.  
  8. #define PLUGIN "[ZP] Class Predator"
  9. #define VERSION "1.0"
  10. #define AUTHOR "TEo"
  11. //Magyarositotta: Ginaa
  12.  
  13. //Some vars
  14. new g_zclass_Predator, g_maxplayers, g_status
  15. new g_sndInv[] = "predator/predator.wav"
  16. new cvar_ability_time, cvar_invamount, cvar_speed, cvar_infect_hp, cvar_cooldown, cvar_gravity, cvar_icon, cvar_dmg_multi
  17. new Float:g_last[33]
  18. new keys = MENU_KEY_1|MENU_KEY_2|MENU_KEY_3
  19. new g_icon[33][16]
  20. new bool: g_ability[33], bool: g_bind[33] = false, bool: g_use[33]
  21.  
  22. //Predator Atributes
  23. new const zclass_name[] = { "Predator" }
  24. new const zclass_info[] = { "Invisible + dmg" }
  25. new const zclass_model[] = { "Predator" }
  26. new const zclass_clawmodel[] = { "v_Predator.mdl" }
  27. const zclass_health = 1600
  28. const zclass_speed = 190
  29. const Float:zclass_gravity = 1.0
  30. const Float:zclass_knockback = 1.0
  31.  
  32. public plugin_init()
  33. {
  34.  
  35. cvar_dmg_multi = register_cvar("zp_predator_dmg_multi", "3")
  36. cvar_ability_time = register_cvar("zp_Predator_ability_long", "10")
  37. cvar_invamount = register_cvar("zp_Predator_visible_amount", "0")
  38. cvar_speed = register_cvar("zp_Predator_max_speed", "400")
  39. cvar_infect_hp = register_cvar("zp_Predator_infect_hp", "300")
  40. cvar_cooldown = register_cvar("zp_Predator_cooldown", "30")
  41. cvar_gravity = register_cvar("zp_Predator_gravity", "700")
  42. cvar_icon = register_cvar("zp_Predator_icon", "1")
  43.  
  44. register_clcmd("ability","ability", ADMIN_ALL, "bind ^"key^" ^"ability^"")
  45. register_forward(FM_PlayerPreThink, "fw_ppt")
  46. register_event("HLTV", "newround", "a", "1=0", "2=0")
  47. register_event("DeathMsg", "death", "a")
  48. register_menucmd(register_menuid("Do you want to bind P ability?"), keys, "bind_p")
  49. RegisterHam( Ham_TakeDamage, "player", "fw_TakeDamage" )
  50.  
  51. g_status = get_user_msgid("StatusIcon")
  52. }
  53.  
  54. public plugin_precache()
  55. {
  56. register_plugin(PLUGIN, VERSION, AUTHOR)
  57. g_zclass_Predator = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
  58. precache_sound(g_sndInv)
  59. }
  60.  
  61. public zp_user_infected_post(id, infector)
  62. {
  63. if (zp_get_user_zombie_class(infector) == g_zclass_Predator)
  64. {
  65. set_pev(infector, pev_health, float(pev(infector, pev_health) + get_pcvar_num(cvar_infect_hp)))
  66. set_hudmessage(255, 0, 0, -1.0, 0.45, 0, 0.0, 3.0, 0.01, 0.01, -1)
  67. show_hudmessage(infector, "+%i HP!", get_pcvar_num(cvar_infect_hp))
  68. }
  69.  
  70. if (zp_get_user_zombie_class(id) == g_zclass_Predator)
  71. {
  72. g_ability[id] = false
  73. set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 255)
  74. set_user_maxspeed(id, float(zclass_speed))
  75. set_user_gravity(id, zclass_gravity)
  76.  
  77. if (!g_bind[id])
  78. {
  79. new menu[192]
  80. format(menu, 191, "Szeretned ha bebindelnenk a kepesseget a P-beture?^n^n1. Igen^n2. Nem^n3. Az E-betuvel szeretnem hasznalni")
  81. show_menu(id, keys, menu)
  82. }
  83. }
  84. }
  85.  
  86. public zp_user_humanized_post(id)
  87. if(zp_get_user_zombie_class(id) == g_zclass_Predator)
  88. ability_end(id)
  89.  
  90. public bind_p(id, keys)
  91. {
  92. g_bind[id] = true
  93. switch(keys)
  94. {
  95. case 0:
  96. client_cmd(id, "bind p ability")
  97.  
  98. case 1:
  99. client_print(id, print_chat, "[ZP] A teljes lathatatlansaghoz ird a consolba: bind ^'^'gomb^'^' ^'^'ability^'^'. Es utana nyomd meg a kivalasztott gombot!")
  100.  
  101. case 2:
  102. g_use[id] = true
  103.  
  104. default:
  105. g_bind[id] = false
  106. }
  107.  
  108. return PLUGIN_HANDLED
  109. }
  110.  
  111. public ability(id)
  112. {
  113. if (zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_zclass_Predator))
  114. {
  115. if(g_ability[id])
  116. {
  117. client_print(id, print_chat, "[ZP] Te mar igyis lathatatlan vagy!!")
  118. return PLUGIN_HANDLED
  119. }
  120.  
  121. if(!is_user_alive(id))
  122. {
  123. client_print(id, print_chat, "[ZP] Halott vagy.Halottak nem tudjak hasznalni a kepesseget.")
  124. return PLUGIN_HANDLED
  125. }
  126.  
  127. static Float: i
  128. i = get_pcvar_float(cvar_cooldown)
  129.  
  130. if (get_gametime() - g_last[id] < i) {
  131. client_print(id, print_chat, "[ZP] Varj %.f0 masodpercet hogy hasznalhasd a kepesseget!", get_pcvar_float(cvar_cooldown) - (get_gametime() - g_last[id]))
  132. return PLUGIN_HANDLED
  133. } else {
  134. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(cvar_invamount))
  135. set_user_maxspeed(id, get_pcvar_float(cvar_speed))
  136. set_user_gravity(id, get_pcvar_float(cvar_gravity) / 800)
  137. emit_sound(id, CHAN_BODY, g_sndInv, 1.0, ATTN_NORM, 0, PITCH_HIGH)
  138. set_hudmessage(200, 100, 0, -1.0, 0.85, 0, 0.0, 3.0, 0.01, 0.01, -1)
  139. show_hudmessage(id, "You are now invisible. Time to hunt!")
  140. set_task(get_pcvar_float(cvar_ability_time), "ability_end", id)
  141. if(get_pcvar_num(cvar_icon) == 1)
  142. set_icon(id)
  143. g_ability[id] = true
  144. }
  145. }
  146. return PLUGIN_CONTINUE
  147. }
  148.  
  149. public ability_end(id)
  150. {
  151. set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 255)
  152. set_user_maxspeed(id, float(zclass_speed))
  153. set_user_gravity(id, zclass_gravity)
  154.  
  155. if (get_pcvar_num(cvar_cooldown) > 0)
  156. client_print(id, print_chat, "[ZP] Varj %i masodpercet,hogy ujra hasznald a kepesseget .", get_pcvar_num(cvar_cooldown))
  157.  
  158. if(get_pcvar_num(cvar_icon) == 1)
  159. delete_icon(id)
  160.  
  161. g_last[id] = get_gametime()
  162. g_ability[id] = false
  163. }
  164.  
  165. public fw_ppt(id)
  166. {
  167. if (!is_user_alive(id) || !zp_get_user_zombie(id))
  168. return FMRES_IGNORED
  169.  
  170. if (g_use[id])
  171. {
  172. static button, oldbutton
  173. button = get_user_button(id)
  174. oldbutton = get_user_oldbutton(id)
  175.  
  176. if (!(button & IN_USE) && (oldbutton & IN_USE))
  177. ability(id)
  178. }
  179.  
  180. if (g_ability[id] && (zp_get_user_zombie_class(id) == g_zclass_Predator) && zp_get_user_zombie(id))
  181. {
  182. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(cvar_invamount))
  183. set_user_maxspeed(id, get_pcvar_float(cvar_speed))
  184. set_pev(id, pev_flTimeStepSound, 999)
  185. set_user_gravity(id, get_pcvar_float(cvar_gravity) / 800)
  186. }
  187.  
  188. return PLUGIN_CONTINUE
  189. }
  190.  
  191. public newround()
  192. {
  193. g_maxplayers = get_maxplayers()
  194.  
  195. for (new id = 1; id <= g_maxplayers; id++)
  196. {
  197. g_last[id] = get_gametime()
  198. g_ability[id] = false
  199. }
  200. }
  201.  
  202. public fw_TakeDamage( victim, inflictor, attacker, Float:damage, damagebits )
  203. {
  204. if ((zp_get_user_zombie_class(attacker) == g_zclass_Predator) && (get_user_weapon(attacker) == CSW_KNIFE))
  205. {
  206. SetHamParamFloat( 4, damage * get_pcvar_float(cvar_dmg_multi) )
  207. }
  208. }
  209.  
  210. public death()
  211. {
  212. new id = read_data(2)
  213. ability_end(id)
  214. return PLUGIN_HANDLED
  215. }
  216.  
  217. public set_icon(id)
  218. {
  219. static color[3], sprite[16]
  220. color = {250, 250, 250}
  221. sprite = "dmg_gas"
  222. g_icon[id] = sprite
  223.  
  224. message_begin(MSG_ONE, g_status, {0, 0, 0}, id)
  225. write_byte(1)
  226. write_string(g_icon[id])
  227. write_byte(color[0])
  228. write_byte(color[1])
  229. write_byte(color[2])
  230. message_end()
  231. }
  232.  
  233. public delete_icon(id)
  234. {
  235. message_begin(MSG_ONE, g_status, {0, 0, 0}, id)
  236. write_byte(0)
  237. write_string(g_icon[id])
  238. message_end()
  239. }
  240.  
  241. stock get_user_button(id)
  242. return pev(id, pev_button)
  243.  
  244. stock get_user_oldbutton(id)
  245. return pev(id, pev_oldbuttons)
  246. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  247. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1034\\ f0\\ fs16 \n\\ par }
  248. */
  249.