HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2. #include <amxmisc>
  3. #include <fakemeta>
  4. #include <cstrike>
  5.  
  6. #define PLUGIN "Super Headshot"
  7. #define VERSION "1.0"
  8. #define AUTHOR "Phantomas"
  9.  
  10. #define head_parts_velocity_min 8
  11. #define head_parts_velocity_max 14
  12. #define head_parts_min 20
  13. #define head_parts_max 25
  14.  
  15. new mdl_head_parts
  16. new spr_blood
  17.  
  18. public plugin_precache()
  19. {
  20. precache_model("models/player/arctic_shs/arctic_shs.mdl")
  21. precache_model("models/player/gign_shs/gign_shs.mdl")
  22. precache_model("models/player/gsg9_shs/gsg9_shs.mdl")
  23. precache_model("models/player/guerilla_shs/guerilla_shs.mdl")
  24. precache_model("models/player/leet_shs/leet_shs.mdl")
  25. precache_model("models/player/sas_shs/sas_shs.mdl")
  26. precache_model("models/player/terror_shs/terror_shs.mdl")
  27. precache_model("models/player/urban_shs/urban_shs.mdl")
  28. precache_model("models/player/vip_shs/vip_shs.mdl")
  29. mdl_head_parts = precache_model("models/headgibs.mdl")
  30. spr_blood = precache_model("sprites/blood.spr")
  31. }
  32.  
  33. public plugin_init()
  34. {
  35. register_plugin(PLUGIN, VERSION, AUTHOR)
  36. register_forward(FM_SetClientKeyValue, "SetClientKeyValue")
  37. }
  38.  
  39. public set_model(const id, const szSetModel[])
  40. {
  41. new szModel[16]
  42. get_user_info(id, "model", szModel, charsmax(szModel))
  43. if(!equal(szModel, szSetModel))
  44. {
  45. set_user_info(id, "model", szSetModel)
  46. }
  47. return FMRES_SUPERCEDE
  48. }
  49.  
  50. public SetClientKeyValue(const id, const szInfoBuffer[], const szKey[], const szValue[])
  51. {
  52. if(equal(szKey, "model"))
  53. {
  54. if(equal(szValue, "arctic"))
  55. {
  56. return set_model(id, "arctic_shs")
  57. } else if(equal(szValue, "gign")) {
  58. return set_model(id, "gign_shs")
  59. } else if(equal(szValue, "gsg9")) {
  60. return set_model(id, "gsg9_shs")
  61. } else if(equal(szValue, "guerilla")) {
  62. return set_model(id, "guerilla_shs")
  63. } else if(equal(szValue, "leet")) {
  64. return set_model(id, "leet_shs")
  65. } else if(equal(szValue, "sas")) {
  66. return set_model(id, "sas_shs")
  67. } else if(equal(szValue, "terror")) {
  68. return set_model(id, "terror_shs")
  69. } else if(equal(szValue, "urban")) {
  70. return set_model(id, "urban_shs")
  71. } else if(equal(szValue, "vip")) {
  72. return set_model(id, "vip_shs")
  73. }
  74. }
  75. return FMRES_IGNORED
  76. }
  77.  
  78. public spawn_blood(const id)
  79. {
  80. if(is_user_alive(id))
  81. {
  82. return PLUGIN_HANDLED
  83. }
  84.  
  85. new const Float:origin[3]
  86. new const Float:angles[3]
  87. engfunc(EngFunc_GetBonePosition, id, 8, origin, angles)
  88.  
  89. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  90. write_byte(TE_BLOODSPRITE)
  91. engfunc(EngFunc_WriteCoord, origin[0])
  92. engfunc(EngFunc_WriteCoord, origin[1])
  93. engfunc(EngFunc_WriteCoord, origin[2])
  94. write_short(spr_blood)
  95. write_short(spr_blood)
  96. write_byte(248)
  97. write_byte(15)
  98. message_end()
  99.  
  100. return PLUGIN_CONTINUE
  101. }
  102.  
  103. public spawn_head_parts(const id)
  104. {
  105. new const Float:origin[3]
  106. new const Float:angles[3]
  107. engfunc(EngFunc_GetBonePosition, id, 8, origin, angles)
  108.  
  109. message_begin(MSG_BROADCAST, SVC_TEMPENTITY)
  110. write_byte(TE_BREAKMODEL)
  111. engfunc(EngFunc_WriteCoord, origin[0])
  112. engfunc(EngFunc_WriteCoord, origin[1])
  113. engfunc(EngFunc_WriteCoord, origin[2])
  114. write_coord(0)
  115. write_coord(0)
  116. write_coord(0)
  117. write_coord(0)
  118. write_coord(0)
  119. write_coord(50)
  120. write_byte(random_num(head_parts_velocity_min, head_parts_velocity_max))
  121. write_short(mdl_head_parts)
  122. write_byte(random_num(head_parts_min, head_parts_max))
  123. write_byte(50)
  124. write_byte(0)
  125. message_end()
  126. }
  127.  
  128. public super_headshot(const id)
  129. {
  130. set_pev(id, pev_body, 2)
  131. spawn_head_parts(id)
  132. set_task(0.5, "spawn_blood", id)
  133. set_task(1.2, "spawn_blood", id)
  134. }
  135.  
  136. public client_death(killer, victim, wpnindex, hitplace, TK)
  137. {
  138. if(hitplace == HIT_HEAD)
  139. {
  140. if(wpnindex == CSW_AWP || wpnindex == CSW_M3 || wpnindex == CSW_DEAGLE || wpnindex == CSW_XM1014 || wpnindex == CSW_SCOUT || wpnindex == CSW_G3SG1 || wpnindex == CSW_SG550)
  141. {
  142. new CsArmorType:armor
  143. cs_get_user_armor(victim, armor)
  144. if(armor != CS_ARMOR_VESTHELM)
  145. {
  146. super_headshot(victim)
  147. }
  148. }
  149. }
  150. }