Advertisement
Guest User

Untitled

a guest
Jul 27th, 2014
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 8.32 KB | None | 0 0
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fun>
  4. #include <fakemeta>
  5. #include <zombieplague>
  6. #include <hamsandwich>
  7. #include <zmvip>
  8.  
  9. #define PLUGIN "[ZP] Class Predator"
  10. #define VERSION "1.0"
  11. #define AUTHOR "TEo"
  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[] = { "*VIP* Predator" }
  24. new const zclass_info[] = { "[ Invisible ]" }
  25. new const zclass_model[] = { "zml_predator" }
  26. new const zclass_clawmodel[] = { "v_zml_predator.mdl" }
  27. const zclass_health = 3200
  28. const zclass_speed = 200
  29. const Float:zclass_gravity = 1.0
  30. const Float:zclass_knockback = 1.0
  31.  
  32. forward zp_class_selected(id, itemid)
  33. native zv_is_user_vip(id)
  34.  
  35. public plugin_init()
  36. {
  37.  
  38. cvar_dmg_multi = register_cvar("zp_predator_dmg_multi", "2")
  39. cvar_ability_time = register_cvar("zp_Predator_ability_long", "8")
  40. cvar_invamount = register_cvar("zp_Predator_visible_amount", "0")
  41. cvar_speed = register_cvar("zp_Predator_max_speed", "300")
  42. cvar_infect_hp = register_cvar("zp_Predator_infect_hp", "100")
  43. cvar_cooldown = register_cvar("zp_Predator_cooldown", "30")
  44. cvar_gravity = register_cvar("zp_Predator_gravity", "700")
  45. cvar_icon = register_cvar("zp_Predator_icon", "1")
  46.  
  47. register_clcmd("ability","ability", ADMIN_ALL, "bind ^"key^" ^"ability^"")
  48. register_forward(FM_PlayerPreThink, "fw_ppt")
  49. register_event("HLTV", "newround", "a", "1=0", "2=0")
  50. register_event("DeathMsg", "death", "a")
  51. register_menucmd(register_menuid("Do you want to bind P ability?"), keys, "bind_p")
  52. RegisterHam( Ham_TakeDamage, "player", "fw_TakeDamage" )
  53.  
  54. g_status = get_user_msgid("StatusIcon")
  55. }
  56.  
  57. public zp_class_selected(id, itemid) {
  58. if(itemid == g_zclass_Predator) {
  59. if(zv_is_user_vip(id)) return ZP_PLUGIN_HANDLED
  60. }
  61. return PLUGIN_CONTINUE
  62. }
  63.  
  64. public plugin_precache()
  65. {
  66. register_plugin(PLUGIN, VERSION, AUTHOR)
  67. g_zclass_Predator = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
  68. precache_sound(g_sndInv)
  69. }
  70.  
  71. public zp_user_infected_post(id, infector)
  72. {
  73. if (zp_get_user_zombie_class(infector) == g_zclass_Predator)
  74. {
  75. set_pev(infector, pev_health, float(pev(infector, pev_health) + get_pcvar_num(cvar_infect_hp)))
  76. set_hudmessage(255, 0, 0, -1.0, 0.45, 0, 0.0, 3.0, 0.01, 0.01, -1)
  77. show_hudmessage(infector, "+%i HP!", get_pcvar_num(cvar_infect_hp))
  78. }
  79.  
  80. if (zp_get_user_zombie_class(id) == g_zclass_Predator)
  81. {
  82. g_ability[id] = false
  83. set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 255)
  84. set_user_maxspeed(id, float(zclass_speed))
  85. set_user_gravity(id, zclass_gravity)
  86.  
  87. if (!g_bind[id])
  88. {
  89. new menu[192]
  90. format(menu, 191, "Do you want to bind P ability?^n^n1. Yes^n2. No^n3. Ability on +USE")
  91. show_menu(id, keys, menu)
  92. }
  93. }
  94. }
  95.  
  96. public zp_user_humanized_post(id)
  97. if(zp_get_user_zombie_class(id) == g_zclass_Predator)
  98. ability_end(id)
  99.  
  100. public bind_p(id, keys)
  101. {
  102. g_bind[id] = true
  103. switch(keys)
  104. {
  105. case 0:
  106. client_cmd(id, "bind p ability")
  107.  
  108. case 1:
  109. client_print(id, print_chat, "[ZP] To be invisible and increase your speed type in console: bind ^'^'key^'^' ^'^'ability^'^'. And than press it!")
  110.  
  111. case 2:
  112. g_use[id] = true
  113.  
  114. default:
  115. g_bind[id] = false
  116. }
  117.  
  118. return PLUGIN_HANDLED
  119. }
  120.  
  121. public ability(id)
  122. {
  123. if (zp_get_user_zombie(id) && (zp_get_user_zombie_class(id) == g_zclass_Predator))
  124. {
  125. if(g_ability[id])
  126. {
  127. client_print(id, print_chat, "[ZP] You are already invisible and have maximum speed.")
  128. return PLUGIN_HANDLED
  129. }
  130.  
  131. if(!is_user_alive(id))
  132. {
  133. client_print(id, print_chat, "[ZP] You are dead now. Dead people can't use abilities.")
  134. return PLUGIN_HANDLED
  135. }
  136.  
  137. static Float: i
  138. i = get_pcvar_float(cvar_cooldown)
  139.  
  140. if (get_gametime() - g_last[id] < i) {
  141. client_print(id, print_chat, "[ZP] Wait %.f0 sec. to use your ability!", get_pcvar_float(cvar_cooldown) - (get_gametime() - g_last[id]))
  142. return PLUGIN_HANDLED
  143. } else {
  144. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(cvar_invamount))
  145. set_user_maxspeed(id, get_pcvar_float(cvar_speed))
  146. set_user_gravity(id, get_pcvar_float(cvar_gravity) / 800)
  147. emit_sound(id, CHAN_BODY, g_sndInv, 1.0, ATTN_NORM, 0, PITCH_HIGH)
  148. set_hudmessage(200, 100, 0, -1.0, 0.85, 0, 0.0, 3.0, 0.01, 0.01, -1)
  149. show_hudmessage(id, "You are now invisible. Time to hunt!")
  150. set_task(get_pcvar_float(cvar_ability_time), "ability_end", id)
  151. if(get_pcvar_num(cvar_icon) == 1)
  152. set_icon(id)
  153. g_ability[id] = true
  154. }
  155. }
  156. return PLUGIN_CONTINUE
  157. }
  158.  
  159. public ability_end(id)
  160. {
  161. set_user_rendering(id, kRenderFxNone, 0, 0, 0, kRenderNormal, 255)
  162. set_user_maxspeed(id, float(zclass_speed))
  163. set_user_gravity(id, zclass_gravity)
  164.  
  165. if (get_pcvar_num(cvar_cooldown) > 0)
  166. client_print(id, print_chat, "[ZP] Wait %i sec to use your ability again.", get_pcvar_num(cvar_cooldown))
  167.  
  168. if(get_pcvar_num(cvar_icon) == 1)
  169. delete_icon(id)
  170.  
  171. g_last[id] = get_gametime()
  172. g_ability[id] = false
  173. }
  174.  
  175. public fw_ppt(id)
  176. {
  177. if (!is_user_alive(id) || !zp_get_user_zombie(id))
  178. return FMRES_IGNORED
  179.  
  180. if (g_use[id])
  181. {
  182. static button, oldbutton
  183. button = get_user_button(id)
  184. oldbutton = get_user_oldbutton(id)
  185.  
  186. if (!(button & IN_USE) && (oldbutton & IN_USE))
  187. ability(id)
  188. }
  189.  
  190. if (g_ability[id] && (zp_get_user_zombie_class(id) == g_zclass_Predator) && zp_get_user_zombie(id))
  191. {
  192. set_user_rendering(id, kRenderFxGlowShell, 0, 0, 0, kRenderTransAlpha, get_pcvar_num(cvar_invamount))
  193. set_user_maxspeed(id, get_pcvar_float(cvar_speed))
  194. set_pev(id, pev_flTimeStepSound, 999)
  195. set_user_gravity(id, get_pcvar_float(cvar_gravity) / 800)
  196. }
  197.  
  198. return PLUGIN_CONTINUE
  199. }
  200.  
  201. public newround()
  202. {
  203. g_maxplayers = get_maxplayers()
  204.  
  205. for (new id = 1; id <= g_maxplayers; id++)
  206. {
  207. g_last[id] = get_gametime()
  208. g_ability[id] = false
  209. }
  210. }
  211.  
  212. public fw_TakeDamage( victim, inflictor, attacker, Float:damage, damagebits )
  213. {
  214. if ((zp_get_user_zombie_class(attacker) == g_zclass_Predator) && (get_user_weapon(attacker) == CSW_KNIFE))
  215. {
  216. SetHamParamFloat( 4, damage * get_pcvar_float(cvar_dmg_multi) )
  217. }
  218. }
  219.  
  220. public death()
  221. {
  222. new id = read_data(2)
  223. ability_end(id)
  224. return PLUGIN_HANDLED
  225. }
  226.  
  227. public set_icon(id)
  228. {
  229. static color[3], sprite[16]
  230. color = {250, 250, 250}
  231. sprite = "dmg_gas"
  232. g_icon[id] = sprite
  233.  
  234. message_begin(MSG_ONE, g_status, {0, 0, 0}, id)
  235. write_byte(1)
  236. write_string(g_icon[id])
  237. write_byte(color[0])
  238. write_byte(color[1])
  239. write_byte(color[2])
  240. message_end()
  241. }
  242.  
  243. public delete_icon(id)
  244. {
  245. message_begin(MSG_ONE, g_status, {0, 0, 0}, id)
  246. write_byte(0)
  247. write_string(g_icon[id])
  248. message_end()
  249. }
  250.  
  251. stock get_user_button(id)
  252. return pev(id, pev_button)
  253.  
  254. stock get_user_oldbutton(id)
  255. return pev(id, pev_oldbuttons)
  256. public zp_user_infected_pre(id) {
  257. if(zv_get_user_flags(id) == 0) {
  258. if(zp_get_user_next_class(id) == g_zclass_Predator) {
  259. zp_set_user_zombie_class(id, 0)
  260. client_print(id, print_center, "Your selected class in only for *VIP* members")
  261. client_print(id, print_chat, "Your selected class in only for *VIP* members. Changed to default zombie class.")
  262. }
  263. }
  264. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement