HLMOD.HU Forrás Megtekintés - www.hlmod.hu
  1. #include <amxmodx>
  2.  
  3. new const g_szUnreal[] = "misc/ut3/unreal.wav";
  4. new g_iKills[33], g_iMaxPlayers;
  5. new g_pNeededKills, g_pAnnounceDelay, g_pAnnounceKills, g_pOnlyAlive, g_pSound, g_pDeathReset;
  6.  
  7. public plugin_precache()
  8. precache_sound(g_szUnreal);
  9.  
  10. public plugin_init()
  11. {
  12. register_plugin("Unreal", "1.2", "hleV");
  13.  
  14. register_dictionary("unreal.txt");
  15.  
  16. g_pNeededKills = register_cvar("ur_neededkills", "1");
  17. g_pAnnounceDelay = register_cvar("ur_announcedelay", "1.0");
  18. g_pAnnounceKills = register_cvar("ur_announcekills", "1");
  19. g_pOnlyAlive = register_cvar("ur_onlyalive", "0");
  20. g_pSound = register_cvar("ur_sound", "2");
  21.  
  22. register_event("HLTV", "eventNewRound", "a", "1=0", "2=0");
  23. register_event("DeathMsg", "eventDeath", "a", "1>0");
  24.  
  25. register_logevent("eventRoundEnd", 2, "1=Round_End");
  26. }
  27.  
  28. public plugin_cfg()
  29. g_iMaxPlayers = get_maxplayers();
  30.  
  31. public client_disconnect(iCl)
  32. g_iKills[iCl] = 0;
  33.  
  34. public eventNewRound()
  35. {
  36. if (!get_pcvar_num(g_pNeededKills))
  37. return;
  38.  
  39. for (new iCl = 1; iCl <= g_iMaxPlayers; iCl++)
  40. g_iKills[iCl] = 0;
  41. }
  42.  
  43. public eventDeath(iKiller, iVictim)
  44. {
  45. if (!get_pcvar_num(g_pNeededKills))
  46. return;
  47.  
  48. if ((iKiller = read_data(1)) == (iVictim = read_data(2)))
  49. if (get_pcvar_num(g_pDeathReset))
  50. g_iKills[iKiller] = 0;
  51.  
  52. g_iKills[iKiller]++;
  53.  
  54. if (get_pcvar_num(g_pDeathReset))
  55. g_iKills[iKiller] = 0;
  56. }
  57.  
  58. public eventRoundEnd(iNeededKills)
  59. {
  60. if (!(iNeededKills = get_pcvar_num(g_pNeededKills)))
  61. return;
  62.  
  63. new iTop, iKills, iOnlyAlive = get_pcvar_num(g_pOnlyAlive);
  64.  
  65. for (new iCl = 1; iCl <= g_iMaxPlayers; iCl++)
  66. {
  67. if ((iOnlyAlive && !is_user_alive(iCl)) || !is_user_connected(iCl))
  68. continue;
  69.  
  70. if (iNeededKills <= g_iKills[iCl] > iKills)
  71. {
  72. iKills = g_iKills[iCl];
  73. iTop = iCl;
  74. }
  75. }
  76.  
  77. if (iTop)
  78. set_task(get_pcvar_float(g_pAnnounceDelay), "taskAnnounceTop", iTop);
  79. }
  80.  
  81. public taskAnnounceTop(iCl)
  82. {
  83. if (!get_pcvar_num(g_pNeededKills))
  84. return;
  85.  
  86. new szName[32], szKills[16];
  87.  
  88. get_user_name(iCl, szName, 31);
  89. set_hudmessage(255, 255, 255, -1.0, 0.25, 0, 6.0, 2.5, 0.1, 0.5, -1);
  90.  
  91. if (get_pcvar_num(g_pAnnounceKills))
  92. formatex(szKills, 15, " (%L)", LANG_PLAYER, "UR_KILLS", g_iKills[iCl]);
  93.  
  94. show_hudmessage(0, "%L%s", LANG_PLAYER, "UR_UNREAL", szName, szKills);
  95. client_cmd(get_pcvar_num(g_pSound) == 2 ? 0 : iCl, "speak %s", g_szUnreal);
  96. }