HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /********************************************************************************
  2. * AMX Mod X script.
  3. *
  4. * Ultimate Sounds (Ultimate_Sounds.sma)
  5. * Copyright (C) 2006-2008 Bmann_420 / Dizzy / Hoboman
  6. *
  7. * This program is free software; you can redistribute it and/or
  8. * modify it under the terms of the GNU General Public License
  9. * as published by the Free Software Foundation; either version 2
  10. * of the License, or (at your option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful,
  13. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. * GNU General Public License for more details.
  16. *
  17. * You should have received a copy of the GNU General Public License
  18. * along with this program; if not, write to the Free Software
  19. * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
  20. *
  21. * In addition, as a special exception, the author gives permission to
  22. * link the code of this program with the Half-Life Game Engine ("HL
  23. * Engine") and Modified Game Libraries ("MODs") developed by Valve,
  24. * L.L.C ("Valve"). You must obey the GNU General Public License in all
  25. * respects for all of the code used other than the HL Engine and MODs
  26. * from Valve. If you modify this file, you may extend this exception
  27. * to your version of the file, but you are not obligated to do so. If
  28. * you do not wish to do so, delete this exception statement from your
  29. * version.
  30. *
  31. *********************************************************************************
  32. *
  33. * AMXX Ultimate Sounds Vers. 1.7
  34. * Last Update: 1/26/2007
  35. *
  36. * by Dizzy / Bmann_420 & Hoboman
  37. * Link: http://forums.alliedmods.net/showthread.php?t=7342
  38. *
  39. *
  40. *********************************************************************************
  41. *
  42. * ///////////////////////////////////////////////////
  43. * // AMXMOD[X] //
  44. * // ::Ultimate sounds:: //
  45. * // Origional: by Hephaistos //
  46. * // Ported by: Dizzy //
  47. * // Edited by: Hoboman, bmann_420 //
  48. * // //
  49. * // cvar: //
  50. * // streak_mode < flags > //
  51. * // "a" - messages //
  52. * // "b" - sounds //
  53. * // //
  54. * // knife_mode < flags > //
  55. * // "a" - messages //
  56. * // "b" - sounds //
  57. * // //
  58. * // hs_mode < flags > //
  59. * // "a" - messages //
  60. * // "b" - sounds //
  61. * // //
  62. * // lastman_mode < flags > //
  63. * // "a" - messages //
  64. * // "b" - hp //
  65. * // "c" - sounds //
  66. * ///////////////////////////////////////////////////
  67. *
  68. *********************************************************************************
  69. */
  70.  
  71. // Plugin Info
  72. new const PLUGIN[] = "Ultimate Sounds"
  73. new const VERSION[] = "1.7"
  74. new const AUTHOR[] = "Dizzy / Bmann_420"
  75.  
  76. // Includes
  77. #include <amxmodx>
  78.  
  79. //Defines
  80. #define KNIFEMESSAGES 5
  81. #define MESSAGESNOHP 5
  82. #define MESSAGESHP 5
  83. #define LEVELS 10
  84.  
  85. //Pcvars
  86. new streak_mode, knife_mode, hs_mode, lastman_mode
  87.  
  88. new gmsgHudSync
  89.  
  90. new kills[33] = {0,...};
  91. new deaths[33] = {0,...};
  92. new alone_ann = 0
  93. new levels[10] = {2, 3, 4, 5, 6, 7, 8, 9, 10, 11};
  94.  
  95. //Streak Sounds
  96. new stksounds[10][] =
  97. {
  98. "misc/multikill",
  99. "misc/megakill",
  100. "misc/ultrakill",
  101. "misc/monsterkill",
  102. "misc/killingspree",
  103. "misc/wickedsick",
  104. "misc/rampage",
  105. "misc/ludacrisskill",
  106. "misc/godlike",
  107. "misc/holyshit"
  108. }
  109.  
  110. new stkmessages[10][] =
  111. {
  112. "%s: Multi-Kill!",
  113. "%s: Mega-Kill!",
  114. "%s: Ultra-Kill!",
  115. "%s: Monster-Kill!",
  116. "%s: Killing Spree!",
  117. "%s: Wicked Sick!",
  118. "%s: Rampage!",
  119. "%s: Ludacriss-Kill",
  120. "%s: Godlike!",
  121. "%s: Holy Shit!"
  122. }
  123.  
  124. new knifemessages[KNIFEMESSAGES][] =
  125. {
  126. "KNIFE_MSG_1",
  127. "KNIFE_MSG_2",
  128. "KNIFE_MSG_3",
  129. "KNIFE_MSG_4",
  130. "KNIFE_MSG_5"
  131. }
  132.  
  133. new messagesnohp[MESSAGESNOHP][] =
  134. {
  135. "NOHP_MSG_1",
  136. "NOHP_MSG_2",
  137. "NOHP_MSG_3",
  138. "NOHP_MSG_4",
  139. "NOHP_MSG_5"
  140. }
  141.  
  142. new messageshp[MESSAGESHP][] =
  143. {
  144. "HP_MSG_1",
  145. "HP_MSG_2",
  146. "HP_MSG_3",
  147. "HP_MSG_4",
  148. "HP_MSG_5"
  149. }
  150.  
  151. public plugin_init()
  152. {
  153. register_plugin(PLUGIN, VERSION, AUTHOR)
  154. register_cvar("ultimate_sounds",VERSION,FCVAR_SERVER|FCVAR_EXTDLL|FCVAR_UNLOGGED|FCVAR_SPONLY)
  155. register_dictionary("ultimate_sounds.txt")
  156. register_event("DeathMsg","hs","a","3=1")
  157. register_event("DeathMsg","knife_kill","a","4&kni")
  158. register_event("ResetHUD", "reset_hud", "b");
  159. register_event("DeathMsg", "death_event", "a", "1>0");
  160. register_event("DeathMsg","death_msg","a")
  161. register_event("SendAudio","roundend_msg","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw")
  162. register_event("TextMsg","roundend_msg","a","2&#Game_C","2&#Game_w")
  163.  
  164. lastman_mode = register_cvar("lastman_mode","abc")
  165. streak_mode = register_cvar("streak_mode","ab")
  166. knife_mode = register_cvar("knife_mode","ab")
  167. hs_mode = register_cvar("hs_mode","ab")
  168.  
  169. gmsgHudSync = CreateHudSyncObj()
  170.  
  171. return PLUGIN_CONTINUE
  172. }
  173.  
  174. get_streak()
  175. {
  176. new streak[3]
  177. get_pcvar_string(streak_mode,streak,2)
  178. return read_flags(streak)
  179. }
  180.  
  181. public death_event(id)
  182. {
  183. new streak = get_streak()
  184.  
  185. if ((streak&1) || (streak&2))
  186. {
  187. new killer = read_data(1);
  188. new victim = read_data(2);
  189.  
  190. kills[killer] += 1;
  191. kills[victim] = 0;
  192. deaths[killer] = 0;
  193. deaths[victim] += 1;
  194.  
  195. for (new i = 0; i < LEVELS; i++)
  196. {
  197. if (kills[killer] == levels[i])
  198. {
  199. announce(killer, i);
  200. return PLUGIN_CONTINUE;
  201. }
  202. }
  203. }
  204. return PLUGIN_CONTINUE;
  205. }
  206.  
  207. announce(killer, level)
  208. {
  209. new streak = get_streak()
  210.  
  211. if (streak&1)
  212. {
  213. new name[32];
  214.  
  215. get_user_name(killer, name, 32);
  216. set_hudmessage(0, 100, 200, 0.05, 0.65, 2, 0.02, 6.0, 0.01, 0.1, 2);
  217. ShowSyncHudMsg(0, gmsgHudSync, stkmessages[level], name);
  218. }
  219.  
  220. if (streak&2){
  221. for(new i=1;i<=get_maxplayers();i++)
  222. if(is_user_connected(i)==1 )
  223. client_cmd(i, "spk %s", stksounds[level]);
  224. }
  225. }
  226.  
  227. public reset_hud(id)
  228. {
  229. new streak = get_streak()
  230.  
  231. if (streak&1)
  232. {
  233.  
  234. if (kills[id] > levels[0])
  235.  
  236. {
  237. client_print(id, print_chat,"%L", id, "KILL_STREAK", kills[id]);
  238. }
  239.  
  240. else if (deaths[id] > 1)
  241.  
  242. {
  243. client_print(id, print_chat,"%L", id, "DEATH_STREAK", deaths[id]);
  244. }
  245. }
  246. }
  247.  
  248. public client_connect(id)
  249. {
  250. new streak = get_streak()
  251.  
  252. if ((streak&1) || (streak&2))
  253. {
  254. kills[id] = 0;
  255. deaths[id] = 0;
  256. }
  257. }
  258.  
  259. public knife_kill()
  260. {
  261. new knifemode[4]
  262. get_pcvar_string(knife_mode,knifemode,4)
  263. new knifemode_bit = read_flags(knifemode)
  264.  
  265. if (knifemode_bit & 1)
  266. {
  267. new killer_id = read_data(1)
  268. new victim_id = read_data(2)
  269. new killer_name[33], victim_name[33]
  270.  
  271. get_user_name(killer_id,killer_name,33)
  272. get_user_name(victim_id,victim_name,33)
  273.  
  274.  
  275. set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
  276. ShowSyncHudMsg(0, gmsgHudSync, "%L", LANG_PLAYER, knifemessages[ random_num(0,KNIFEMESSAGES-1) ],killer_name,victim_name)
  277. }
  278.  
  279. if (knifemode_bit & 2)
  280. {
  281. for(new i=1;i<=get_maxplayers();i++)
  282. if( is_user_connected(i) == 1 )
  283. client_cmd(i,"spk misc/humiliation")
  284. }
  285. }
  286.  
  287.  
  288. public roundend_msg(id)
  289.  
  290. alone_ann = 0
  291.  
  292. public death_msg(id)
  293. {
  294.  
  295. new lmmode[8]
  296. get_pcvar_string(lastman_mode,lmmode,8)
  297. new lmmode_bit = read_flags(lmmode)
  298.  
  299. new players_ct[32], players_t[32], ict, ite, last
  300. get_players(players_ct,ict,"ae","CT")
  301. get_players(players_t,ite,"ae","TERRORIST")
  302.  
  303. if (ict==1&&ite==1)
  304. {
  305. new name1[32], name2[32]
  306. get_user_name(players_ct[0],name1,32)
  307. get_user_name(players_t[0],name2,32)
  308. set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
  309.  
  310. if (lmmode_bit & 1)
  311. {
  312. if (lmmode_bit & 2)
  313. {
  314. ShowSyncHudMsg(0, gmsgHudSync, "%s (%i hp) vs. %s (%i hp)",name1,get_user_health(players_ct[0]),name2,get_user_health(players_t[0]))
  315. }
  316.  
  317. else
  318. {
  319. ShowSyncHudMsg(0, gmsgHudSync, "%s vs. %s",name1,name2)
  320. }
  321.  
  322. if (lmmode_bit & 4)
  323. {
  324. for(new i=1;i<=get_maxplayers();i++)
  325. if( is_user_connected(i) == 1 )
  326. client_cmd(i,"spk misc/maytheforce")
  327. }
  328. }
  329. }
  330. else
  331. {
  332. if (ict==1&&ite>1&&alone_ann==0&&(lmmode_bit & 4))
  333. {
  334. last=players_ct[0]
  335. client_cmd(last,"spk misc/oneandonly")
  336.  
  337. }
  338.  
  339. else if (ite==1&&ict>1&&alone_ann==0&&(lmmode_bit & 4))
  340. {
  341. last=players_t[0]
  342. client_cmd(last,"spk misc/oneandonly")
  343. }
  344.  
  345. else
  346. {
  347. return PLUGIN_CONTINUE
  348. }
  349. alone_ann = last
  350. new name[32]
  351. get_user_name(last,name,32)
  352.  
  353. if (lmmode_bit & 1)
  354. {
  355. set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
  356.  
  357. if (lmmode_bit & 2)
  358. {
  359. ShowSyncHudMsg(0, gmsgHudSync, "%L", LANG_PLAYER, messageshp[ random_num(0,MESSAGESHP-1) ],ite ,ict ,name,get_user_health(last))
  360. }
  361.  
  362. else
  363. {
  364. ShowSyncHudMsg(0, gmsgHudSync, "%L", LANG_PLAYER, messagesnohp[ random_num(0,MESSAGESNOHP-1) ],ite ,ict ,name )
  365. }
  366. }
  367.  
  368. }
  369. return PLUGIN_CONTINUE
  370. }
  371.  
  372.  
  373. public hs()
  374. {
  375. new hsmode[4]
  376. get_pcvar_string(hs_mode,hsmode,4)
  377. new hsmode_bit = read_flags(hsmode)
  378.  
  379. if (hsmode_bit & 1)
  380. {
  381. new killer_id = read_data(1)
  382. new victim_id = read_data(2)
  383. new victim_name[33]
  384.  
  385. get_user_name(victim_id,victim_name,33)
  386.  
  387. set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 3.0, 3.0, 0.15, 0.15, 1)
  388. ShowSyncHudMsg(killer_id, gmsgHudSync, "::BOOOOM-HEADSHOT::",victim_name)
  389. }
  390.  
  391. if (hsmode_bit & 2)
  392. {
  393. for(new i=1;i<=get_maxplayers();i++)
  394. if( is_user_connected(i)==1 )
  395. client_cmd(i,"spk misc/headshot")
  396. }
  397. }
  398.  
  399. public plugin_precache()
  400. {
  401. precache_sound("misc/monsterkill.wav")
  402. precache_sound("misc/godlike.wav")
  403. precache_sound("misc/headshot.wav")
  404. precache_sound("misc/humiliation.wav")
  405. precache_sound("misc/killingspree.wav")
  406. precache_sound("misc/multikill.wav")
  407. precache_sound("misc/ultrakill.wav")
  408. precache_sound("misc/maytheforce.wav")
  409. precache_sound("misc/oneandonly.wav")
  410. precache_sound("misc/rampage.wav")
  411. precache_sound("misc/holyshit.wav")
  412. precache_sound("misc/megakill.wav")
  413. precache_sound("misc/wickedsick.wav")
  414. precache_sound("misc/ludacrisskill.wav")
  415.  
  416. return PLUGIN_CONTINUE
  417. }