HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* Plugin generated by AMXX-Studio */
  2.  
  3. #include <amxmodx>
  4. #include <engine>
  5. #include <fakemeta>
  6. #include <hamsandwich>
  7.  
  8. #define PLUGIN "Death Effect"
  9. #define VERSION "1.0"
  10. #define AUTHOR "Sneaky.amxx | GlobalModders.net"
  11.  
  12. #define EFFECT_CLASSNAME "love_saigon"
  13. #define TASK_REVIVE 4415
  14.  
  15. new Float:g_DeadBody[33][3], g_DeathGod_SprID
  16.  
  17. public plugin_init()
  18. {
  19. register_plugin(PLUGIN, VERSION, AUTHOR)
  20.  
  21. register_think(EFFECT_CLASSNAME, "fw_EffectThink")
  22. RegisterHam(Ham_Killed, "player", "fw_PlayerKilled_Post", 1)
  23. }
  24.  
  25. public plugin_precache()
  26. {
  27. g_DeathGod_SprID = precache_model("sprites/zomb_death.spr")
  28. precache_model("models/effect/ghost.mdl")
  29. }
  30.  
  31. public fw_PlayerKilled_Post(Victim, Attacker)
  32. {
  33. // Handle Shit
  34. static Float:Origin[3]; pev(Victim, pev_origin, Origin)
  35. g_DeadBody[Victim] = Origin
  36.  
  37. // Death Effect
  38. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  39. write_byte(TE_SPRITE)
  40. engfunc(EngFunc_WriteCoord, Origin[0])
  41. engfunc(EngFunc_WriteCoord, Origin[1])
  42. engfunc(EngFunc_WriteCoord, Origin[2] + 16.0)
  43. write_short(g_DeathGod_SprID)
  44. write_byte(4)
  45. write_byte(255)
  46. message_end()
  47.  
  48. set_task(0.5, "Check_PlayerDeath", Victim+TASK_REVIVE)
  49. }
  50.  
  51. public Check_PlayerDeath(id)
  52. {
  53. id -= TASK_REVIVE
  54.  
  55. if(is_user_alive(id))
  56. return
  57. if(pev(id, pev_deadflag) != 2)
  58. {
  59. set_task(0.25, "Check_PlayerDeath", id+TASK_REVIVE)
  60. return
  61. }
  62.  
  63. static Float:Velocity[3]; Velocity[2] = 150.0
  64. Send_EffectModel(g_DeadBody[id], Velocity, "models/effect/ghost.mdl", 2.0, 0)
  65. }
  66.  
  67. public fw_EffectThink(Ent)
  68. {
  69. if(!pev_valid(Ent))
  70. return
  71.  
  72. set_pev(Ent, pev_nextthink, get_gametime() + 0.01)
  73. set_pev(Ent, pev_flags, FL_KILLME)
  74. }
  75.  
  76. public Send_EffectModel(Float:Origin[3], Float:Velocity[3], const Model[], Float:Time, Anim)
  77. {
  78. static Ent; Ent = create_entity("info_target")
  79. if(!pev_valid(Ent)) return
  80.  
  81. // Set Properties
  82. set_pev(Ent, pev_takedamage, DAMAGE_NO)
  83. set_pev(Ent, pev_solid, SOLID_NOT)
  84. set_pev(Ent, pev_movetype, MOVETYPE_FLY)
  85.  
  86. // Set Sprite
  87. set_pev(Ent, pev_classname, EFFECT_CLASSNAME)
  88. engfunc(EngFunc_SetModel, Ent, Model)
  89.  
  90. // Set Rendering
  91. set_pev(Ent, pev_renderfx, kRenderFxNone)
  92. set_pev(Ent, pev_rendermode, kRenderTransAdd)
  93. set_pev(Ent, pev_renderamt, 255.0)
  94.  
  95. // Set other & Origin
  96. engfunc(EngFunc_SetOrigin, Ent, Origin)
  97. set_pev(Ent, pev_velocity, Velocity)
  98.  
  99. // Animation
  100. set_pev(Ent, pev_animtime, get_gametime())
  101. set_pev(Ent, pev_framerate, 1.0)
  102. set_pev(Ent, pev_sequence, Anim)
  103.  
  104. // Force Think
  105. set_pev(Ent, pev_nextthink, get_gametime() + Time)
  106. }
  107.