HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. Worms Like deaths
  3. by Drekes
  4.  
  5. Description:
  6.  
  7. There are a lot of people that know the worms games.
  8. This plugin tryes to reinact that style of death, by making an explosion and
  9. putting a grave like the dead worms do.
  10.  
  11.  
  12. Cvars:
  13.  
  14. amx_wormsdeaths_on 1 Turns worms deaths on/off
  15. amx_wormsdeath_sound 1 Turns the sound on/off
  16. amx_wormsdeath_hidecorpse 1 Turns hiding dead body's on/off
  17.  
  18. Changelog:
  19.  
  20. v1.0: Initial release
  21. v1.1: Added cvar to hide corpse
  22. v1.2: Optimized a lot of code
  23. Changed the way to hide the corpse
  24.  
  25. Credits:
  26.  
  27. Wrecked: Helping to solve annoying tag mismatch and other stuff
  28. Anakin_cstrike: the grave models
  29. Arkshine: Alot of improvement info
  30.  
  31. Note:
  32.  
  33. I made the corpse invisible, because blocking the msg wasn't working like i expected
  34.  
  35. To do:
  36. I have no idea
  37.  
  38. Fordította: BBk - Death of Legend
  39.  
  40. */
  41. #include <amxmodx>
  42. #include <hamsandwich>
  43. #include <engine>
  44.  
  45. #define VERSION "1.2"
  46.  
  47. new const hahasnd[] = "misc/grave_sound2.wav";
  48.  
  49. new const g_mdl_tgrave[] = "models/wormsdeaths/t_grave.mdl";
  50. new const g_mdl_ctgrave[] = "models/wormsdeaths/ct_grave.mdl";
  51.  
  52. new const g_Classname[] = "worms_grave";
  53.  
  54.  
  55. new cvar_on, cvar_sound, cvar_hidecorpse;
  56. new xplodespr, smokespr;
  57.  
  58.  
  59.  
  60. public plugin_init()
  61. {
  62. register_plugin("Worms like Deaths", VERSION, "Drekes");
  63.  
  64. RegisterHam(Ham_Killed, "player", "Event_Ham_Killed_Pre", 0);
  65.  
  66. register_cvar("wormsdeaths_version",VERSION,FCVAR_SERVER | FCVAR_SPONLY);
  67.  
  68. register_think(g_Classname, "Fwd_Grave_Think");
  69.  
  70. cvar_on = register_cvar("amx_wormsdeath_on", "1");
  71. cvar_sound = register_cvar("amx_wormsdeath_sound", "1");
  72. cvar_hidecorpse = register_cvar("amx_wormsdeath_hidecorpse", "1");
  73. }
  74.  
  75. public plugin_precache()
  76. {
  77. precache_model(g_mdl_tgrave);
  78. precache_model(g_mdl_ctgrave);
  79.  
  80. xplodespr = precache_model("sprites/wormsdeaths/explosion.spr");
  81. smokespr = precache_model("sprites/wormsdeaths/smoke.spr");
  82.  
  83. precache_sound(hahasnd);
  84. }
  85.  
  86. public Event_Ham_Killed_Pre(victim, attacker, shouldgib)
  87. {
  88. if(get_pcvar_num(cvar_on))
  89. {
  90. if(is_user_connected(victim))
  91. {
  92. new Float: origin[3];
  93. entity_get_vector(victim, EV_VEC_origin, origin);
  94.  
  95. make_smoke(origin);
  96. make_explosion(origin);
  97. set_grave(victim, origin);
  98.  
  99. if(get_pcvar_num(cvar_hidecorpse))
  100. {
  101. origin[2] -= 30.0;
  102. entity_set_origin(victim, origin);
  103. }
  104. }
  105. }
  106. }
  107.  
  108. public set_grave(id, Float: origin[3])
  109. {
  110. new ent = create_entity("info_target");
  111.  
  112. if(!ent)
  113. return;
  114.  
  115. entity_set_origin(ent, origin);
  116. entity_set_string(ent, EV_SZ_classname, g_Classname);
  117.  
  118. switch(get_user_team(id))
  119. {
  120. case 1:
  121. entity_set_model(ent, g_mdl_tgrave);
  122.  
  123. case 2:
  124. entity_set_model(ent, g_mdl_ctgrave);
  125. }
  126.  
  127. entity_set_int(ent, EV_INT_solid, SOLID_BBOX);
  128. entity_set_int(ent, EV_INT_movetype, MOVETYPE_TOSS);
  129.  
  130. new Float:maxs[3] = {10.0, 40.0, 19.0};
  131. new Float:mins[3] = {-11.0, -2.0, -5.0};
  132. entity_set_size(ent, mins, maxs);
  133.  
  134. entity_set_float(ent, EV_FL_nextthink, get_gametime() + 10.0);
  135. }
  136.  
  137. public Fwd_Grave_Think(Ent)
  138. {
  139. if(is_valid_ent(Ent))
  140. remove_entity(Ent);
  141. }
  142.  
  143. make_explosion(Float: origin[3])
  144. {
  145. new IntOrigin[3];
  146. FVecIVec(origin, IntOrigin);
  147.  
  148. message_begin(MSG_PVS, SVC_TEMPENTITY, IntOrigin);
  149. write_byte(TE_EXPLOSION);
  150. write_coord(IntOrigin[0]);
  151. write_coord(IntOrigin[1]);
  152. write_coord(IntOrigin[2]);
  153. write_short(xplodespr);
  154. write_byte(10);
  155. write_byte(2);
  156. write_byte(TE_EXPLFLAG_NOSOUND);
  157. message_end();
  158.  
  159. if(get_pcvar_num(cvar_sound))
  160. emit_sound(0, CHAN_ITEM, "misc/grave_sound2.wav" , 1.0, ATTN_NORM, 0, PITCH_NORM);
  161. }
  162.  
  163. make_smoke(Float: origin[3])
  164. {
  165. new IntOrigin[3];
  166. FVecIVec(origin, IntOrigin);
  167.  
  168. message_begin(MSG_PVS, SVC_TEMPENTITY, IntOrigin);
  169. write_byte(TE_EXPLOSION);
  170. write_coord(IntOrigin[0]);
  171. write_coord(IntOrigin[1]);
  172. write_coord(IntOrigin[2]);
  173. write_short(smokespr);
  174. write_byte(50);
  175. write_byte(2);
  176. write_byte(TE_EXPLFLAG_NOSOUND);
  177. message_end();
  178. }