HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /* AMX Mod X
  2. * Death-info beams III
  3. *
  4. * cvars:
  5. * amx_dib_holdtime <time in 0.1 seconds> - Life of beams
  6. * amx_dib_width <width in 0.1 units> - Width of beams
  7. * amx_dib_cross <size in 0.1 units> - Size of markers
  8. * amx_dib_color <RRRGGGBBB> - RGB color of beam
  9. *
  10. * This program is free software; you can redistribute it and/or modify it
  11. * under the terms of the GNU General Public License as published by the
  12. * Free Software Foundation; either version 2 of the License, or (at
  13. * your option) any later version.
  14. *
  15. * This program is distributed in the hope that it will be useful, but
  16. * WITHOUT ANY WARRANTY; without even the implied warranty of
  17. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  18. * General Public License for more details.
  19. *
  20. * You should have received a copy of the GNU General Public License
  21. * along with this program; if not, write to the Free Software Foundation,
  22. * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  23. *
  24. * In addition, as a special exception, the author gives permission to
  25. * link the code of this program with the Half-Life Game Engine ("HL
  26. * Engine") and Modified Game Libraries ("MODs") developed by Valve,
  27. * L.L.C ("Valve"). You must obey the GNU General Public License in all
  28. * respects for all of the code used other than the HL Engine and MODs
  29. * from Valve. If you modify this file, you may extend this exception
  30. * to your version of the file, but you are not obligated to do so. If
  31. * you do not wish to do so, delete this exception statement from your
  32. * version.
  33. */
  34.  
  35.  
  36. #include <amxmodx>
  37. #include <csstats>
  38.  
  39.  
  40. new g_sprite;
  41.  
  42.  
  43. public plugin_init()
  44. {
  45. register_plugin("Death-info beams", "3.0", "BMJ");
  46. register_event("CS_DeathMsg", "death_msg", "a");
  47.  
  48. register_cvar("amx_dib_holdtime", "200");
  49. register_cvar("amx_dib_width", "10");
  50. register_cvar("amx_dib_cross", "30");
  51. register_cvar("amx_dib_color", "000255000");
  52. }
  53.  
  54.  
  55. public plugin_precache()
  56. {
  57. g_sprite = precache_model("sprites/dot.spr");
  58. }
  59.  
  60.  
  61. public death_msg()
  62. {
  63. new killer = read_data(1);
  64. new victim = read_data(2);
  65. if (killer == victim)
  66. return PLUGIN_HANDLED;
  67.  
  68. new vec_killer[3];
  69. new vec_victim[3];
  70. get_user_origin(killer, vec_killer, 1);
  71. get_user_origin(victim, vec_victim);
  72.  
  73. new color[12];
  74. get_cvar_string("amx_dib_color", color, 11);
  75. new b = str_to_num(color[6]);
  76. color[6] = 0;
  77. new g = str_to_num(color[3]);
  78. color[3] = 0;
  79. new r = str_to_num(color[0]);
  80.  
  81. new size = get_cvar_num("amx_dib_cross");
  82.  
  83. message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, victim);
  84. write_byte(0);
  85. write_coord(vec_killer[0] + size);
  86. write_coord(vec_killer[1]);
  87. write_coord(vec_killer[2]);
  88. write_coord(vec_killer[0] - size);
  89. write_coord(vec_killer[1]);
  90. write_coord(vec_killer[2]);
  91. write_short(g_sprite);
  92. write_byte(1);
  93. write_byte(1);
  94. write_byte(get_cvar_num("amx_dib_holdtime")); // x 0.1
  95. write_byte(get_cvar_num("amx_dib_width")); // x 0.1
  96. write_byte(0);
  97. if (get_user_team(killer) == 1)
  98. {
  99. write_byte(255);
  100. write_byte(50);
  101. write_byte(50);
  102. }
  103. else
  104. {
  105. write_byte(100);
  106. write_byte(100);
  107. write_byte(255);
  108. }
  109. write_byte(100);
  110. write_byte(0);
  111. message_end();
  112.  
  113. message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, victim);
  114. write_byte(0);
  115. write_coord(vec_killer[0]);
  116. write_coord(vec_killer[1] + size);
  117. write_coord(vec_killer[2]);
  118. write_coord(vec_killer[0]);
  119. write_coord(vec_killer[1] - size);
  120. write_coord(vec_killer[2]);
  121. write_short(g_sprite);
  122. write_byte(1);
  123. write_byte(1);
  124. write_byte(get_cvar_num("amx_dib_holdtime")); // x 0.1
  125. write_byte(get_cvar_num("amx_dib_width")); // x 0.1
  126. write_byte(0);
  127. if (get_user_team(killer) == 1)
  128. {
  129. write_byte(255);
  130. write_byte(50);
  131. write_byte(50);
  132. }
  133. else
  134. {
  135. write_byte(100);
  136. write_byte(100);
  137. write_byte(255);
  138. }
  139. write_byte(100);
  140. write_byte(0);
  141. message_end();
  142.  
  143. message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, victim);
  144. write_byte(0);
  145. write_coord(vec_killer[0]);
  146. write_coord(vec_killer[1]);
  147. write_coord(vec_killer[2] + size);
  148. write_coord(vec_killer[0]);
  149. write_coord(vec_killer[1]);
  150. write_coord(vec_killer[2] - size);
  151. write_short(g_sprite);
  152. write_byte(1);
  153. write_byte(1);
  154. write_byte(get_cvar_num("amx_dib_holdtime")); // x 0.1
  155. write_byte(get_cvar_num("amx_dib_width")); // x 0.1
  156. write_byte(0);
  157. if (get_user_team(killer) == 1)
  158. {
  159. write_byte(255);
  160. write_byte(50);
  161. write_byte(50);
  162. }
  163. else
  164. {
  165. write_byte(100);
  166. write_byte(100);
  167. write_byte(255);
  168. }
  169. write_byte(100);
  170. write_byte(0);
  171. message_end();
  172.  
  173. message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, victim);
  174. write_byte(0);
  175. write_coord(vec_victim[0] + size);
  176. write_coord(vec_victim[1]);
  177. write_coord(vec_victim[2]);
  178. write_coord(vec_victim[0] - size);
  179. write_coord(vec_victim[1]);
  180. write_coord(vec_victim[2]);
  181. write_short(g_sprite);
  182. write_byte(1);
  183. write_byte(1);
  184. write_byte(get_cvar_num("amx_dib_holdtime")); // x 0.1
  185. write_byte(get_cvar_num("amx_dib_width")); // x 0.1
  186. write_byte(0);
  187. if (get_user_team(victim) == 1)
  188. {
  189. write_byte(255);
  190. write_byte(50);
  191. write_byte(50);
  192. }
  193. else
  194. {
  195. write_byte(100);
  196. write_byte(100);
  197. write_byte(255);
  198. }
  199. write_byte(100);
  200. write_byte(0);
  201. message_end();
  202.  
  203. message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, victim);
  204. write_byte(0);
  205. write_coord(vec_victim[0]);
  206. write_coord(vec_victim[1] + size);
  207. write_coord(vec_victim[2]);
  208. write_coord(vec_victim[0]);
  209. write_coord(vec_victim[1] - size);
  210. write_coord(vec_victim[2]);
  211. write_short(g_sprite);
  212. write_byte(1);
  213. write_byte(1);
  214. write_byte(get_cvar_num("amx_dib_holdtime")); // x 0.1
  215. write_byte(get_cvar_num("amx_dib_width")); // x 0.1
  216. write_byte(0);
  217. if (get_user_team(victim) == 1)
  218. {
  219. write_byte(255);
  220. write_byte(50);
  221. write_byte(50);
  222. }
  223. else
  224. {
  225. write_byte(50);
  226. write_byte(50);
  227. write_byte(255);
  228. }
  229. write_byte(100);
  230. write_byte(0);
  231. message_end();
  232.  
  233. message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, victim);
  234. write_byte(0);
  235. write_coord(vec_victim[0]);
  236. write_coord(vec_victim[1]);
  237. write_coord(vec_victim[2] + size);
  238. write_coord(vec_victim[0]);
  239. write_coord(vec_victim[1]);
  240. write_coord(vec_victim[2] - size);
  241. write_short(g_sprite);
  242. write_byte(1);
  243. write_byte(1);
  244. write_byte(get_cvar_num("amx_dib_holdtime")); // x 0.1
  245. write_byte(get_cvar_num("amx_dib_width")); // x 0.1
  246. write_byte(0);
  247. if (get_user_team(victim) == 1)
  248. {
  249. write_byte(255);
  250. write_byte(50);
  251. write_byte(50);
  252. }
  253. else
  254. {
  255. write_byte(100);
  256. write_byte(100);
  257. write_byte(255);
  258. }
  259. write_byte(100);
  260. write_byte(0);
  261. message_end();
  262.  
  263. message_begin(MSG_ONE, SVC_TEMPENTITY, {0, 0, 0}, victim);
  264. write_byte(0);
  265. write_coord(vec_killer[0]);
  266. write_coord(vec_killer[1]);
  267. write_coord(vec_killer[2]);
  268. write_coord(vec_victim[0]);
  269. write_coord(vec_victim[1]);
  270. write_coord(vec_victim[2]);
  271. write_short(g_sprite);
  272. write_byte(1);
  273. write_byte(1);
  274. write_byte(get_cvar_num("amx_dib_holdtime")); // x 0.1
  275. write_byte(get_cvar_num("amx_dib_width")); // x 0.1
  276. write_byte(0);
  277. write_byte(r);
  278. write_byte(g);
  279. write_byte(b);
  280. write_byte(100);
  281. write_byte(0);
  282. message_end();
  283.  
  284. return PLUGIN_HANDLED;
  285. }