HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. [ZP] Class : [A]dvanced [I]nvisible Zombie
  3. ( special Zombie class )
  4. by Fry!
  5.  
  6.  
  7. Description :
  8.  
  9. AI zombie in full name ( Advanced Invisible ) have ability when you duck you will be invisible.
  10. Zombie has a weird feature when you will duck you will breathe out some sounds. Invisible can change by cvar.
  11.  
  12.  
  13. Cvars :
  14.  
  15. zp_ai_zombie_invisibility "0" - Amount of invisibility (0 max invisible - 255 max visible)
  16.  
  17.  
  18. Changelog :
  19.  
  20. 16/06/2009 - v1.0 - First release
  21. 28/06/2009 - v1.0.5 - removed if player is connected or disconnected, dropped death event, fixed minor bug, removed player flag if he is on ground, optimized code.
  22. 12/07/2009 - v1.0.8 - changing else instead of if in second flag check, removed stock, added 2 sounds while zombie is ducking to know if he is near you.
  23. */
  24.  
  25. #include <amxmodx>
  26. #include <fakemeta>
  27. #include <zombieplague>
  28.  
  29. #define PLUGIN "[ZP] Class : [A]dvanced [I]nvisible Zombie"
  30. #define VERSION "1.0.8"
  31. #define AUTHOR "Fry!"
  32.  
  33. new const zclass_name[] = "Demon Zombie"
  34. new const zclass_info[] = "Guggolva lathatatlan"
  35. new const zclass_model[] = "lathatatlan_zm"
  36. new const zclass_clawmodel[] = "v_knife_lathatatlan.mdl"
  37. const zclass_health = 1600
  38. const zclass_speed = 190
  39. const Float:zclass_gravity = 1.0
  40. const Float:zclass_knockback = 1.35
  41.  
  42. new const zombie_idle_sound1[] = "zombie_plague/zombie_moan.wav"
  43. new const zombie_idle_sound2[] = "zombie_plague/zombie_breathing.wav"
  44.  
  45. new zisA, zisB
  46. new g_zclass_ai_zombie, g_ai_zombie_invisible
  47.  
  48. public plugin_init()
  49. {
  50. register_plugin(PLUGIN, VERSION, AUTHOR)
  51.  
  52. register_cvar("zp_zclass_advanced_invisble_zombie",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
  53.  
  54. g_ai_zombie_invisible = register_cvar("zp_ai_zombie_invisibility", "0")
  55.  
  56. register_forward(FM_PlayerPreThink, "fm_PlayerPreThink")
  57. }
  58.  
  59. public plugin_precache()
  60. {
  61. g_zclass_ai_zombie = zp_register_zombie_class(zclass_name, zclass_info, zclass_model, zclass_clawmodel, zclass_health, zclass_speed, zclass_gravity, zclass_knockback)
  62.  
  63. zisA = engfunc(EngFunc_PrecacheSound, zombie_idle_sound1)
  64. zisB = engfunc(EngFunc_PrecacheSound, zombie_idle_sound2)
  65. }
  66.  
  67. public zp_user_infected_post(player, infector)
  68. {
  69. if (zp_get_user_zombie_class(player) == g_zclass_ai_zombie)
  70. {
  71. if ((pev(player, pev_flags) & FL_DUCKING))
  72. {
  73. set_pev(player, pev_renderfx, kRenderFxGlowShell)
  74. set_pev(player, pev_rendermode, kRenderTransAlpha)
  75. set_pev(player, pev_renderamt, get_pcvar_float(g_ai_zombie_invisible))
  76. }
  77. }
  78. return PLUGIN_CONTINUE
  79. }
  80.  
  81. public fm_PlayerPreThink(id)
  82. {
  83. if (!is_user_alive(id) || !zp_get_user_zombie(id))
  84. return FMRES_IGNORED
  85.  
  86. if (zp_get_user_zombie_class(id) != g_zclass_ai_zombie)
  87. return FMRES_IGNORED
  88.  
  89. if (!(pev(id, pev_flags) & FL_DUCKING))
  90. {
  91. set_pev(id, pev_renderfx, kRenderFxNone)
  92. set_pev(id, pev_rendermode, kRenderNormal)
  93. set_pev(id, pev_renderamt, 255.0)
  94.  
  95. new iRandomNum = random_num(zisA, zisB)
  96.  
  97. if (iRandomNum == zisA)
  98. {
  99. emit_sound(id, CHAN_VOICE, zombie_idle_sound1, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  100. }
  101.  
  102. else if (iRandomNum == zisB)
  103. {
  104. emit_sound(id, CHAN_VOICE, zombie_idle_sound2, VOL_NORM, ATTN_NORM, 0, PITCH_NORM)
  105. }
  106. }
  107.  
  108. else
  109. {
  110. set_pev(id, pev_renderfx, kRenderFxGlowShell)
  111. set_pev(id, pev_rendermode, kRenderTransAlpha)
  112. set_pev(id, pev_renderamt, get_pcvar_float(g_ai_zombie_invisible))
  113. }
  114.  
  115. return FMRES_IGNORED
  116. }
  117. /* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
  118. *{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1049\\ f0\\ fs16 \n\\ par }
  119. */
  120.