HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. /*
  2. This plugin was created first by Alka with specific sound !
  3. It was necesar to precache the sound and to be downloaded
  4. by clients.
  5.  
  6. This version modified by me it using vox sounds that plays the
  7. health and armour of your killer and does not require any
  8. precache.
  9.  
  10. Credits:
  11.  
  12. Alka - Using his color stock for color chat print (new version)
  13. - Creating the plugin (main ideea & work) and can be found
  14. here: http://forums.alliedmods.net/showthread.php?t=52458
  15.  
  16. The new version (this plugin) can be found on Allied Modds Forum
  17. here: http://forums.alliedmods.net/showthread.php?t=89384
  18.  
  19. Available CVAR's:
  20. amx_chatmsg_killer "1" // Enable/Disable chat message for killer (Def: 1 - ON)
  21. amx_chatmsg_victim "1" // Enable/Disable chat message for victim (Def: 1 - ON)
  22. amx_play_sound "0" // Enable/Disable vox sound for victim (Def: 1 - ON)
  23.  
  24. */
  25.  
  26. #include <amxmodx>
  27. #include <amxmisc>
  28.  
  29. #define VERSION "2.7"
  30.  
  31. new g_ChatKiller, g_ChatVictim, g_Sound, g_SayText, g_MaxClients
  32.  
  33.  
  34. public plugin_init()
  35. {
  36. /* Register plugin */
  37. register_plugin("Kill Message w/ VOX", VERSION, "God@Dorin");
  38.  
  39. /* Register plugin version */
  40. register_cvar("chatmsg_version", VERSION, FCVAR_SERVER|FCVAR_SPONLY);
  41. set_cvar_string("chatmsg_version", VERSION);
  42.  
  43. /* Register Death Event */
  44. register_event("DeathMsg", "event_death", "a");
  45.  
  46. /* Register Language file */
  47. register_dictionary("kill_chat_message.txt");
  48.  
  49. /* Register cvars */
  50. g_ChatKiller = register_cvar("amx_chatmsg_killer","1");
  51. g_ChatVictim = register_cvar("amx_chatmsg_victim","1");
  52. g_Sound = register_cvar("amx_play_sound","0");
  53. g_MaxClients = get_maxplayers()
  54.  
  55. g_SayText = get_user_msgid("SayText");
  56. }
  57.  
  58. public event_death()
  59. {
  60. new killer = read_data(1);
  61. new victim = read_data(2);
  62.  
  63. if ( !( 1 <= killer <= g_MaxClients ) || killer == victim )
  64. {
  65. return PLUGIN_CONTINUE;
  66. }
  67.  
  68. new vicname[32], killname[32]
  69. new frags = get_user_frags(killer);
  70. new armor = get_user_armor(killer);
  71. new health = get_user_health(killer);
  72. get_user_name(victim,vicname,31);
  73. get_user_name(killer,killname,31);
  74.  
  75. if(get_pcvar_num(g_ChatKiller) ==1)
  76. {
  77. client_printc(killer,"%L", killer, "KILL_MSG_VIC", vicname);
  78. }
  79.  
  80. if(get_pcvar_num(g_ChatVictim) ==1)
  81. {
  82. client_printc(victim,"%L", victim, "KILL_MSG_KILL", killname, health, armor, frags+1);
  83. }
  84.  
  85. if(get_pcvar_num(g_Sound) ==1)
  86. {
  87. new healthstr[21], armorstr[21]
  88. num_to_word(health, healthstr, 20);
  89. num_to_word(armor, armorstr, 20);
  90.  
  91. client_cmd(victim, "spk ^"vox/%s health and %s armor^"", healthstr, armorstr)
  92. }
  93. return PLUGIN_CONTINUE;
  94. }
  95. stock client_printc(const id, const string[], {Float, Sql, Resul,_}:...) {
  96.  
  97. new msg[191], players[32], count = 1;
  98. vformat(msg, sizeof msg - 1, string, 3);
  99.  
  100. replace_all(msg,190,"!g","^4");
  101. replace_all(msg,190,"!y","^1");
  102. replace_all(msg,190,"!t","^3");
  103.  
  104. if(id)
  105. players[0] = id;
  106. else
  107. get_players(players,count,"ch");
  108.  
  109. for (new i = 0 ; i < count ; i++)
  110. {
  111. if (is_user_connected(players[i]))
  112. {
  113. message_begin(MSG_ONE_UNRELIABLE, g_SayText,_, players[i]);
  114. write_byte(players[i]);
  115. write_string(msg);
  116. message_end();
  117. }
  118. }
  119. }
  120.