hlmod.hu
https://hlmod.hu/

A plugin nem működik. Nem tölti be.
https://hlmod.hu/viewtopic.php?f=9&t=31660
Oldal: 1 / 1

Szerző:  Roland981 [2025.10.14. 16:34 ]
Hozzászólás témája:  A plugin nem működik. Nem tölti be.

Sziasztok !

Az alábbi plugint valamiért nem tölti be szerverem. Valaki tudna segíteni, hogy miért van ez ?

Köszönöm előre is !

  1. /*  Ultimate Hang (HU) – AMXX (CS 1.6) – v1.6 (AMXX 1.8.1 kompatibilis)
  2.  *  Funkciok:
  3.  *   - Kor eleji random uzenetek + "Ez a X. kor" (kozep HUD, random szin)
  4.  *   - Headshot: global hang (4 fajta), felirat nelkul
  5.  *   - Kill-lepcsok HUD (3/5/7/9/11/13/15/17), random szin bal also + hangok
  6.  *   - Bomba:
  7.  *       • lerakas: hang + piros villogo HUD,
  8.  *       • defuse:  hang + piros villogo HUD,
  9.  *       • felvetel (Got_The_Bomb): NINCS hang, piros villogo HUD,
  10.  *       • elejtes (Dropped_The_Bomb): NINCS hang, feher kozep HUD,
  11.  *       • robbanas (Target_Bombed): HANG (HUD nelkul),
  12.  *       • C4 visszaszamlalas 10→1 hangokkal
  13.  *   - Granat kill hang (2), Keses kill hang (3), Suicide (3)
  14.  *   - First Blood (2)
  15.  *   - Elo jatekosok bal also feher HUD-on (T/CT maradek)
  16.  *   - Aim-HUD (ellenseg nev; csapattars: Nev -- HP / AP / fegyver)
  17.  *   - Halalkor: "Sebzett :" + listak; "Aldozatok :" + listak
  18.  *   - 1vX clutch + hang; 1v1 duel + hang
  19.  *   - Kor eleji CHAT stat sorok (elozo korbol): kombo / deathstreak
  20.  *   - Kor vegen HUD: Legjobb pont & Legjobb sebzes; TOTAL csak a nyertes csapatnak
  21.  */
  22.  
  23. #include <amxmodx>
  24. #include <amxmisc>
  25. #include <fakemeta>
  26. #include <hamsandwich>
  27. #include <engine>
  28. #include <cstrike>
  29.  
  30. #define COMBO_TIMEOUT    4.0
  31. #define HUD_CENTER_Y     0.30
  32. #define HUD_BL_X         0.02
  33. #define HUD_BL_Y         0.90
  34. #define HUD_CROSS_Y      0.55
  35. #define MAXP             33
  36.  
  37. // -------------------- Hangok --------------------
  38. new const SND_RSTART[][] = { "quake/round1.wav","quake/round2.wav","quake/round3.wav","quake/round4.wav" };
  39. new const SND_HS[][]     = { "quake/headshot1.wav","quake/headshot2.wav","quake/headshot3.wav","quake/headshot4.wav" };
  40. new const SND_KSTEP[][]  = {
  41.     "quake/multikill.wav", "quake/ultrakill.wav","quake/monsterkill.wav","quake/unstoppable.wav",
  42.     "quake/ludicrouskill.wav","quake/combowhore.wav","quake/holyshit.wav","quake/godlike.wav"
  43. };
  44. // Bomba – pickup HANG NINCS; lerakas/defuse/robbanas VAN hang
  45. new const SND_B_PLANTED[]  = "quake/bomb_planted.wav";
  46. new const SND_B_DEFUSED[]  = "quake/bomb_defused.wav";
  47. new const SND_B_EXPLODED[] = "quake/bomb_exploded.wav";
  48.  
  49. new const SND_CNT[][ ] = {
  50.     "quake/count10.wav","quake/count9.wav","quake/count8.wav","quake/count7.wav","quake/count6.wav",
  51.     "quake/count5.wav","quake/count4.wav","quake/count3.wav","quake/count2.wav","quake/count1.wav"
  52. };
  53.  
  54. new const SND_CLUTCH[]   = "quake/clutch.wav";
  55. new const SND_DUEL1V1[]  = "quake/duel1v1.wav";
  56.  
  57. new const SND_GRENADE[][] = { "quake/grenade_kill1.wav","quake/grenade_kill2.wav" };
  58. new const SND_KNIFE[][]   = { "quake/knife_kill1.wav","quake/knife_kill2.wav","quake/knife_kill3.wav" };
  59. new const SND_SUICIDE[][] = { "quake/suicide1.wav","quake/suicide2.wav","quake/suicide3.wav" };
  60. new const SND_FIRSTBLOOD[][] = { "quake/firstblood1.wav","quake/firstblood2.wav" };
  61.  
  62. // Kor eleji random uzenetek
  63. new const RND_MSGS[][] = { "Kuzdj es harcolj!","Play! Play! Play! Play!","Valaszd ki a fegyvered!" };
  64.  
  65. // -------------------- Allapot --------------------
  66. new Float:g_lastKillTime[MAXP];
  67. new g_combo[MAXP], g_comboHS[MAXP];
  68. new g_bestCombo[MAXP], g_lastRoundBestCombo[MAXP];
  69. new g_deathStreak[MAXP];
  70.  
  71. new g_roundNum;
  72.  
  73. new g_kills[MAXP], g_hs[MAXP];
  74. new Float:g_dmg[MAXP];
  75. new g_shots[MAXP], g_hits[MAXP];
  76.  
  77. // csapat totals (index 2=T, 3=CT)
  78. new g_tKills[4], g_tHS[4], g_tShots[4], g_tHits[4];
  79.  
  80. // per-life
  81. new Float:g_dmgFrom[MAXP][MAXP];
  82. new g_hitsFrom[MAXP][MAXP];
  83. new g_lastWeap[MAXP][MAXP][24];
  84.  
  85. new bool:g_bombPlanted;
  86. new g_bombTasks[10];
  87.  
  88. new g_tBlink[MAXP], g_tR[MAXP], g_tG[MAXP], g_tB[MAXP];
  89. new bool:g_ann1vX, bool:g_ann1v1;
  90.  
  91. new g_prevWpn[MAXP], g_prevClip[MAXP];
  92.  
  93. new g_roundRealKills; // FIRST BLOOD számláló
  94.  
  95. // -------------------- Plugin --------------------
  96. public plugin_init()
  97. {
  98.     register_plugin("Ultimate Hang (HU) AMXX", "1.6", "Assistant");
  99.  
  100.     register_event("HLTV","ev_round_start","a","1=0","2=0");
  101.     register_event("SendAudio","ev_ctwin","a","2=%!MRAD_ctwin");
  102.     register_event("SendAudio","ev_terwin","a","2=%!MRAD_terwin");
  103.     register_event("DeathMsg","ev_death","a");
  104.     register_event("Damage","ev_damage","b","2!0");
  105.     register_event("CurWeapon","ev_curweapon","be","1=1");
  106.  
  107.     // Bomba logeventek
  108.     register_logevent("log_bomb_planted",  3, "2=Planted_The_Bomb");
  109.     register_logevent("log_bomb_defused",  3, "2=Defused_The_Bomb");
  110.     register_logevent("log_bomb_dropped",  3, "2=Dropped_The_Bomb");
  111.     register_logevent("log_bomb_got",      3, "2=Got_The_Bomb");
  112.     register_logevent("log_bomb_exploded", 3, "2=Target_Bombed");
  113.  
  114.     set_task(0.15, "task_aimhud", 7777, _, _, "b");
  115.  
  116.     reset_totals();
  117. }
  118.  
  119. public plugin_precache()
  120. {
  121.     for (new i=0;i<sizeof SND_RSTART;i++) precache_sound(SND_RSTART[i]);
  122.     for (new i=0;i<sizeof SND_HS;i++)     precache_sound(SND_HS[i]);
  123.     for (new i=0;i<sizeof SND_KSTEP;i++)  precache_sound(SND_KSTEP[i]);
  124.     for (new i=0;i<sizeof SND_CNT;i++)    precache_sound(SND_CNT[i]);
  125.     precache_sound(SND_B_PLANTED);
  126.     precache_sound(SND_B_DEFUSED);
  127.     precache_sound(SND_B_EXPLODED);
  128.     precache_sound(SND_CLUTCH);
  129.     precache_sound(SND_DUEL1V1);
  130.     for (new i=0;i<sizeof SND_GRENADE;i++) precache_sound(SND_GRENADE[i]);
  131.     for (new i=0;i<sizeof SND_KNIFE;i++)   precache_sound(SND_KNIFE[i]);
  132.     for (new i=0;i<sizeof SND_SUICIDE;i++) precache_sound(SND_SUICIDE[i]);
  133.     for (new i=0;i<sizeof SND_FIRSTBLOOD;i++) precache_sound(SND_FIRSTBLOOD[i]);
  134. }
  135.  
  136. // -------------------- Round start --------------------
  137. public ev_round_start()
  138. {
  139.     g_roundNum++;
  140.     g_bombPlanted = false;
  141.     g_roundRealKills = 0;
  142.     cancel_c4_tasks();
  143.     reset_totals_round();
  144.  
  145.     g_ann1v1 = false;
  146.     g_ann1vX = false;
  147.  
  148.     for (new i=1;i<MAXP;i++)
  149.     {
  150.         g_combo[i]=0; g_comboHS[i]=0; g_lastKillTime[i]=0.0;
  151.         reset_perlife(i);
  152.         g_prevWpn[i]=0; g_prevClip[i]=-1;
  153.     }
  154.  
  155.     spk_all(SND_RSTART[random_num(0, sizeof SND_RSTART - 1)]);
  156.  
  157.     new r,g,b; rand_rgb(r,g,b);
  158.     center_all(r,g,b, 2.0, "%s", RND_MSGS[random_num(0, sizeof RND_MSGS - 1)]);
  159.     center_all(r,g,b, 2.0, "Ez a %d. kor", g_roundNum);
  160.  
  161.     for (new i=1; i<MAXP; i++)
  162.     {
  163.         if (!is_user_connected(i)) continue;
  164.  
  165.         if (g_lastRoundBestCombo[i] >= 2)
  166.             client_print(i, print_chat, "* Te megoltel %d ellenseget egymas utan.", g_lastRoundBestCombo[i]);
  167.         else if (g_deathStreak[i] >= 1)
  168.             client_print(i, print_chat, "* Ovatosabban egymas utan %d haltal meg.", g_deathStreak[i]);
  169.  
  170.         g_bestCombo[i] = 0;
  171.     }
  172. }
  173.  
  174. // -------------------- CurWeapon -> loves szamlalo --------------------
  175. public ev_curweapon(id)
  176. {
  177.     if (!is_user_alive(id)) return;
  178.  
  179.     new wpn = read_data(2);
  180.     new clip = read_data(3);
  181.  
  182.     if (g_prevWpn[id] != wpn)
  183.     {
  184.         g_prevWpn[id] = wpn;
  185.         g_prevClip[id] = clip;
  186.         return;
  187.     }
  188.     if (g_prevClip[id] == -1)
  189.     {
  190.         g_prevClip[id] = clip;
  191.         return;
  192.     }
  193.  
  194.     if (clip < g_prevClip[id])
  195.     {
  196.         g_shots[id]++;
  197.         new team = get_user_team(id);
  198.         if (team==1) g_tShots[2]++;
  199.         else if (team==2) g_tShots[3]++;
  200.     }
  201.     g_prevClip[id] = clip;
  202. }
  203.  
  204. // -------------------- Damage/hits/dmg + fegyver nyomkovetes --------------------
  205. public ev_damage(victim)
  206. {
  207.     if (!is_user_connected(victim)) return;
  208.  
  209.     new wpn, body;
  210.     new attacker = get_user_attacker(victim, wpn, body);
  211.     if (attacker<=0 || attacker==victim || !is_user_connected(attacker)) return;
  212.  
  213.     new dmg = read_data(2);
  214.     g_dmg[attacker] += float(dmg);
  215.     g_hits[attacker]++;
  216.  
  217.     new teamA = get_user_team(attacker); // 1=T, 2=CT
  218.     if (teamA==1) g_tHits[2]++; else if (teamA==2) g_tHits[3]++;
  219.  
  220.     g_dmgFrom[attacker][victim] += float(dmg);
  221.     g_hitsFrom[attacker][victim]++;
  222.  
  223.     new wname[24] = "unknown";
  224.     if (wpn>0) get_weaponname(wpn, wname, charsmax(wname)); // "weapon_m4a1"
  225.     trim_weapon_prefix(wname);
  226.     copy(g_lastWeap[attacker][victim], 23, wname);
  227. }
  228.  
  229. // -------------------- Death --------------------
  230. public ev_death()
  231. {
  232.     new killer = read_data(1);
  233.     new victim = read_data(2);
  234.     new hs     = read_data(3);
  235.     new weap[24]; read_data(4, weap, charsmax(weap));
  236.  
  237.     // Suicide
  238.     if (killer == victim && is_user_connected(victim))
  239.     {
  240.         spk_all(SND_SUICIDE[random_num(0, sizeof SND_SUICIDE - 1)]);
  241.         g_deathStreak[victim]++;
  242.         reset_perlife(victim);
  243.         return;
  244.     }
  245.  
  246.     // HE grenade (random 2)
  247.     if (equali(weap, "hegrenade"))
  248.         spk_all(SND_GRENADE[random_num(0, sizeof SND_GRENADE - 1)]);
  249.  
  250.     // Knife kill (random 3)
  251.     if (equali(weap, "knife"))
  252.         spk_all(SND_KNIFE[random_num(0, sizeof SND_KNIFE - 1)]);
  253.  
  254.     // Headshot hang
  255.     if (hs == 1)
  256.         spk_all(SND_HS[random_num(0, sizeof SND_HS - 1)]);
  257.  
  258.     // FIRST BLOOD: elso valodi kill (nem suicide)
  259.     if (is_user_connected(killer) && killer!=victim)
  260.     {
  261.         if (g_roundRealKills == 0)
  262.             spk_all(SND_FIRSTBLOOD[random_num(0, sizeof SND_FIRSTBLOOD - 1)]);
  263.         g_roundRealKills++;
  264.  
  265.         // per-kor
  266.         g_kills[killer]++;
  267.         if (hs==1) g_hs[killer]++;
  268.  
  269.         // team totals (1=T,2=CT -> 2=T,3=CT)
  270.         new tA = get_user_team(killer);
  271.         if (tA==1){ g_tKills[2]++; if (hs==1) g_tHS[2]++; }
  272.         else if (tA==2){ g_tKills[3]++; if (hs==1) g_tHS[3]++; }
  273.  
  274.         // combo
  275.         new Float:now = get_gametime();
  276.         if (now - g_lastKillTime[killer] <= COMBO_TIMEOUT) g_combo[killer]++;
  277.         else { g_combo[killer]=1; g_comboHS[killer]=0; }
  278.         g_lastKillTime[killer]=now;
  279.         if (hs==1) g_comboHS[killer]++;
  280.  
  281.         handle_combo_threshold(killer, g_combo[killer]);
  282.  
  283.         show_alive_hint();
  284.         g_deathStreak[killer]=0;
  285.  
  286.         if (g_combo[killer] > g_bestCombo[killer]) g_bestCombo[killer]=g_combo[killer];
  287.     }
  288.  
  289.     if (is_user_connected(victim))
  290.     {
  291.         // Halalkori listak
  292.         new rr,gg,bb; rand_bright(rr,gg,bb);
  293.  
  294.         center_to(victim, rr,gg,bb, 1.6, "Sebzett :");
  295.         new idx[32], cnt=0;
  296.         for (new a=1; a<MAXP; a++)
  297.         {
  298.             if (!is_user_connected(a) || a==victim) continue;
  299.             if (g_dmgFrom[a][victim] > 0.0) idx[cnt++]=a;
  300.         }
  301.         sort_by_dmg(idx, cnt, true, victim);
  302.         new lines = (cnt>5)?5:cnt;
  303.         for (new i=0; i<lines; i++)
  304.         {
  305.             new a = idx[i];
  306.             new nm[32]; get_user_name(a, nm, charsmax(nm));
  307.             new dmg = floatround(g_dmgFrom[a][victim], floatround_floor);
  308.             new hits = g_hitsFrom[a][victim];
  309.             new w[24]; copy(w, charsmax(w), g_lastWeap[a][victim]);
  310.             center_to(victim, rr,gg,bb, 1.3, "%s  -  %d talalat / %d dmg / %s", nm, hits, dmg, (w[0]?w:"unknown"));
  311.         }
  312.  
  313.         center_to(victim, rr,gg,bb, 1.6, "Aldozatok :");
  314.         new jdx[32], jcnt=0;
  315.         for (new t=1; t<MAXP; t++)
  316.         {
  317.             if (!is_user_connected(t) || t==victim) continue;
  318.             if (g_dmgFrom[victim][t] > 0.0) jdx[jcnt++]=t;
  319.         }
  320.         sort_by_dmg(jdx, jcnt, true, -victim);
  321.         new lines2 = (jcnt>5)?5:jcnt;
  322.         for (new j=0; j<lines2; j++)
  323.         {
  324.             new t = jdx[j];
  325.             new nm2[32]; get_user_name(t, nm2, charsmax(nm2));
  326.             new dmg2 = floatround(g_dmgFrom[victim][t], floatround_floor);
  327.             new hits2 = g_hitsFrom[victim][t];
  328.             new w2[24]; copy(w2, charsmax(w2), g_lastWeap[victim][t]);
  329.             center_to(victim, rr,gg,bb, 1.3, "%s  -  %d talalat / %d dmg / %s", nm2, hits2, dmg2, (w2[0]?w2:"unknown"));
  330.         }
  331.  
  332.         reset_perlife(victim);
  333.     }
  334.  
  335.     check_clutch_state();
  336. }
  337.  
  338. // -------------------- Bomb esemenyek --------------------
  339. stock get_log_actor(name[], len, &userid)
  340. {
  341.     new loguser[96];
  342.     read_logargv(0, loguser, charsmax(loguser));
  343.     parse_loguser(loguser, name, len, userid);
  344. }
  345.  
  346. // LERAKÁS – VAN hang + piros villogo HUD + 10→1 visszaszamlalo hangok
  347. public log_bomb_planted()
  348. {
  349.     g_bombPlanted = true;
  350.  
  351.     new name[64], userid;
  352.     get_log_actor(name, charsmax(name), userid);
  353.  
  354.     spk_all(SND_B_PLANTED);
  355.     flash_center("%s jatekos elesitette a bombat", name);
  356.  
  357.     new c4 = get_cvar_num("mp_c4timer"); if (c4<=0) c4=35;
  358.     for (new i=0;i<10;i++)
  359.     {
  360.         new delay = c4 - (10 - i);
  361.         if (delay < 0) delay = 0;
  362.         set_task(float(delay), "task_countdown", 500+i);
  363.         g_bombTasks[i] = 500+i;
  364.     }
  365. }
  366.  
  367. public task_countdown(tid)
  368. {
  369.     if (!g_bombPlanted) return;
  370.     new idx = tid - 500; if (idx<0 || idx>9) return;
  371.     spk_all(SND_CNT[idx]);
  372. }
  373.  
  374. // DEFUSE – VAN hang + piros villogo HUD
  375. public log_bomb_defused()
  376. {
  377.     new name[64], userid;
  378.     get_log_actor(name, charsmax(name), userid);
  379.  
  380.     spk_all(SND_B_DEFUSED);
  381.     flash_center("%s jatekos hatastalanitotta a bombat", name);
  382.  
  383.     g_bombPlanted=false;
  384.     cancel_c4_tasks();
  385. }
  386.  
  387. // ELEJTÉS – NINCS hang, feher kozep HUD
  388. public log_bomb_dropped()
  389. {
  390.     new name[64], userid;
  391.     get_log_actor(name, charsmax(name), userid);
  392.  
  393.     set_hudmessage(255,255,255, -1.0, HUD_CENTER_Y, 0, 0.0, 1.6, 0.0, 0.0, -1);
  394.     show_hudmessage(0, "%s jatekos elejtette a bombat", name);
  395. }
  396.  
  397. // FELVÉTEL – NINCS hang, piros villogo HUD
  398. public log_bomb_got()
  399. {
  400.     new name[64], userid;
  401.     get_log_actor(name, charsmax(name), userid);
  402.  
  403.     flash_center("%s jatekos felvette a bombat", name);
  404. }
  405.  
  406. // ROBBANÁS – CSAK hang (HUD nelkul)
  407. public log_bomb_exploded()
  408. {
  409.     spk_all(SND_B_EXPLODED);
  410.     g_bombPlanted = false;
  411.     cancel_c4_tasks();
  412. }
  413.  
  414. stock cancel_c4_tasks()
  415. {
  416.     for (new i=0;i<10;i++)
  417.     {
  418.         if (g_bombTasks[i] > 0) remove_task(g_bombTasks[i]);
  419.         g_bombTasks[i]=0;
  420.     }
  421. }
  422.  
  423. // -------------------- Round end (ctwin/terwin) – AMXX 1.8.1 kompat (nincs goto) --------------------
  424. public ev_ctwin(){ round_end_summary(3); }
  425. public ev_terwin(){ round_end_summary(2); }
  426.  
  427. round_end_summary(winner) // 2=T, 3=CT
  428. {
  429.     for (new i=1;i<MAXP;i++)
  430.         if (is_user_connected(i)) g_lastRoundBestCombo[i]=g_bestCombo[i];
  431.  
  432.     new bestScorePl=0, bestScore=-99999;
  433.     new bestDmgPl=0, shots=0, hits=0, hs=0; new Float:bestDmg=-1.0;
  434.  
  435.     for (new i=1;i<MAXP;i++)
  436.     {
  437.         if (!is_user_connected(i)) continue;
  438.  
  439.         new score = get_user_frags(i);
  440.         if (score > bestScore){ bestScore=score; bestScorePl=i; }
  441.  
  442.         if (g_dmg[i] > bestDmg)
  443.         {
  444.             bestDmg = g_dmg[i];
  445.             shots   = g_shots[i];
  446.             hits    = g_hits[i];
  447.             hs      = g_hs[i];
  448.             bestDmgPl = i;
  449.         }
  450.     }
  451.  
  452.     if (bestScorePl>0)
  453.     {
  454.         new n1[32]; get_user_name(bestScorePl, n1, charsmax(n1));
  455.         new r,g,b; rand_rgb(r,g,b);
  456.         center_all(r,g,b, 0.0, "Legjobb pont : %s", n1);
  457.         rand_rgb(r,g,b);
  458.         center_all(r,g,b, 0.0, "Pont : %d", bestScore);
  459.     }
  460.  
  461.     if (bestDmgPl>0)
  462.     {
  463.         new n2[32]; get_user_name(bestDmgPl, n2, charsmax(n2));
  464.         new r2,g2,b2; rand_rgb(r2,g2,b2);
  465.         center_all(r2,g2,b2, 0.0, "Legjobb sebzes : %s", n2);
  466.  
  467.         new Float:pct = (shots>0) ? (float(hits)/float(shots)*100.0) : 0.0;
  468.         rand_rgb(r2,g2,b2);
  469.         center_all(r2,g2,b2, 0.0, "Sebzes : %d   Talalatok : %d / %d (%.0f%%%%)", floatround(bestDmg), hits, shots, pct);
  470.  
  471.         rand_rgb(r2,g2,b2);
  472.         center_all(r2,g2,b2, 0.0, "Headshotok : %d", hs);
  473.     }
  474.  
  475.     if (winner==2 || winner==3)
  476.     {
  477.         new kills, ths, tshots, thits; new Float:tpct;
  478.         new teamName[4];
  479.  
  480.         if (winner==3) { // CT
  481.             kills=g_tKills[3]; ths=g_tHS[3]; tshots=g_tShots[3]; thits=g_tHits[3];
  482.             tpct = (tshots>0) ? (float(thits)/float(tshots)*100.0) : 0.0;
  483.             copy(teamName, charsmax(teamName), "CT");
  484.         } else {         // T
  485.             kills=g_tKills[2]; ths=g_tHS[2]; tshots=g_tShots[2]; thits=g_tHits[2];
  486.             tpct = (tshots>0) ? (float(thits)/float(tshots)*100.0) : 0.0;
  487.             copy(teamName, charsmax(teamName), "T");
  488.         }
  489.  
  490.         new r3,g3,b3; rand_rgb(r3,g3,b3);
  491.         center_all(r3,g3,b3, 0.0, "TOTAL");
  492.         rand_rgb(r3,g3,b3);
  493.         center_all(r3,g3,b3, 0.0, "%s osszesen: %d oles (%d headshot)", teamName, kills, ths);
  494.         rand_rgb(r3,g3,b3);
  495.         center_all(r3,g3,b3, 0.0, "Talalatok : %d / %d (%.0f%%%%)", thits, tshots, tpct);
  496.     }
  497.  
  498.     for (new i2=1;i2<MAXP;i2++)
  499.     {
  500.         reset_roundstats_client(i2);
  501.         reset_perlife(i2);
  502.         g_prevWpn[i2]=0; g_prevClip[i2]=-1;
  503.     }
  504.     reset_totals_round();
  505. }
  506.  
  507. // -------------------- Kill-lepcsok HUD + hang --------------------
  508. handle_combo_threshold(id, kills)
  509. {
  510.     new idx = -1;
  511.     if (kills>=17) idx=7;
  512.     else if (kills>=15) idx=6;
  513.     else if (kills>=13) idx=5;
  514.     else if (kills>=11) idx=4;
  515.     else if (kills>=9)  idx=3;
  516.     else if (kills>=7)  idx=2;
  517.     else if (kills>=5)  idx=1;
  518.     else if (kills>=3)  idx=0;
  519.  
  520.     if (idx==-1) return;
  521.  
  522.     spk_all(SND_KSTEP[idx]);
  523.  
  524.     if (kills>=5)
  525.     {
  526.         new r,g,b; rand_bright(r,g,b);
  527.         bottomleft_all(r,g,b, 2.0, "%s",
  528.             (idx==0)?"multi kill":
  529.             (idx==1)?"ultra kill":
  530.             (idx==2)?"monster kill":
  531.             (idx==3)?"unstoppable":
  532.             (idx==4)?"ludicrous kill":
  533.             (idx==5)?"combo whore":
  534.             (idx==6)?"holy shit":"godlike");
  535.     }
  536.  
  537.     set_task(COMBO_TIMEOUT+0.2, "task_combo_end", id);
  538. }
  539. public task_combo_end(id)
  540. {
  541.     if (!is_user_connected(id)) return;
  542.     if (get_gametime() - g_lastKillTime[id] <= COMBO_TIMEOUT) return;
  543.  
  544.     if (g_combo[id] >= 2)
  545.     {
  546.         new r,g,b; rand_bright(r,g,b);
  547.         bottomleft_all(r,g,b, 2.2, "%d kill kombo, %d headshot", g_combo[id], g_comboHS[id]);
  548.     }
  549.     g_combo[id]=0; g_comboHS[id]=0;
  550. }
  551.  
  552. // -------------------- Elo jatekosok kiirasa --------------------
  553. show_alive_hint()
  554. {
  555.     new t=0, ct=0;
  556.     for (new i=1;i<MAXP;i++)
  557.     {
  558.         if (!is_user_connected(i) || !is_user_alive(i)) continue;
  559.         new tm = get_user_team(i);
  560.         if (tm==1) t++;
  561.         else if (tm==2) ct++;
  562.     }
  563.     set_hudmessage(255,255,255, HUD_BL_X, HUD_BL_Y, 0, 0.0, 2.0, 0.0, 0.0, -1);
  564.     show_hudmessage(0, "%d Terrorista maradt hatra^n%d CT maradt hatra", t, ct);
  565. }
  566.  
  567. // -------------------- AIM-HUD --------------------
  568. public task_aimhud()
  569. {
  570.     for (new id=1; id<MAXP; id++)
  571.     {
  572.         if (!is_user_connected(id) || !is_user_alive(id)) continue;
  573.  
  574.         new target, body;
  575.         get_user_aiming(id, target, body, 9999);
  576.         if (target<=0 || target>=MAXP) continue;
  577.         if (!is_user_connected(target) || !is_user_alive(target)) continue;
  578.  
  579.         g_tBlink[id] = 1 - g_tBlink[id];
  580.         if (g_tBlink[id]) rand_bright(g_tR[id], g_tG[id], g_tB[id]);
  581.  
  582.         new nm[32]; get_user_name(target, nm, charsmax(nm));
  583.         new myT = get_user_team(id);
  584.         new tgT = get_user_team(target);
  585.  
  586.         if (myT == tgT && myT >= 1)
  587.         {
  588.             new hp = get_user_health(target);
  589.             new ap = get_user_armor(target);
  590.  
  591.             new clip, ammo, wpnid = get_user_weapon(target, clip, ammo);
  592.             new wname[24] = "unknown";
  593.             if (wpnid>0) get_weaponname(wpnid, wname, charsmax(wname));
  594.             trim_weapon_prefix(wname);
  595.  
  596.             set_hudmessage(g_tR[id], g_tG[id], g_tB[id], -1.0, HUD_CROSS_Y, 0, 0.0, 0.18, 0.0, 0.0, -2);
  597.             show_hudmessage(id, "%s  --  %d HP / %d AP / %s", nm, hp, ap, wname);
  598.         }
  599.         else if ((tgT==1 || tgT==2) && myT != tgT)
  600.         {
  601.             set_hudmessage(g_tR[id], g_tG[id], g_tB[id], -1.0, HUD_CROSS_Y, 0, 0.0, 0.18, 0.0, 0.0, -2);
  602.             show_hudmessage(id, "%s", nm);
  603.         }
  604.     }
  605. }
  606.  
  607. // -------------------- Segedfuggvenyek --------------------
  608. stock spk_all(const sound[]){ client_cmd(0, "spk ^"%s^"", sound); }
  609.  
  610. stock center_all(r,g,b, Float:hold, const fmt[], any:...)
  611. {
  612.     static msg[192];
  613.     vformat(msg, charsmax(msg), fmt, 5);
  614.     set_hudmessage(r,g,b, -1.0, HUD_CENTER_Y, 0, 0.0, hold>0.0?hold:2.0, 0.0, 0.0, -1);
  615.     show_hudmessage(0, "%s", msg);
  616. }
  617. stock center_to(id, r,g,b, Float:hold, const fmt[], any:...)
  618. {
  619.     if (!is_user_connected(id)) return;
  620.     static msg[192];
  621.     vformat(msg, charsmax(msg), fmt, 7);
  622.     set_hudmessage(r,g,b, -1.0, HUD_CENTER_Y, 0, 0.0, hold>0.0?hold:1.8, 0.0, 0.0, -1);
  623.     show_hudmessage(id, "%s", msg);
  624. }
  625. stock bottomleft_all(r,g,b, Float:hold, const fmt[], any:...)
  626. {
  627.     static msg[192];
  628.     vformat(msg, charsmax(msg), fmt, 5);
  629.     set_hudmessage(r,g,b, HUD_BL_X, HUD_BL_Y, 0, 0.0, hold>0.0?hold:2.0, 0.0, 0.0, -1);
  630.     show_hudmessage(0, "%s", msg);
  631. }
  632.  
  633. stock flash_center(const fmt[], any:...)
  634. {
  635.     static msg[128]; vformat(msg, charsmax(msg), fmt, 1);
  636.     set_hudmessage(255,0,0, -1.0, HUD_CENTER_Y, 0, 0.0, 0.9, 0.0, 0.0, -1);
  637.     show_hudmessage(0, "%s", msg);
  638.     set_task(0.22, "flash_again");
  639. }
  640. public flash_again()
  641. {
  642.     set_hudmessage(255,0,0, -1.0, HUD_CENTER_Y, 0, 0.0, 0.12, 0.0, 0.0, -1);
  643.     show_hudmessage(0, "( ! )");
  644. }
  645.  
  646. stock rand_rgb(&r,&g,&b){ r=random_num(128,255); g=random_num(128,255); b=random_num(128,255); }
  647. stock rand_bright(&r,&g,&b){ r=random_num(160,255); g=random_num(160,255); b=random_num(160,255); }
  648.  
  649. stock trim_weapon_prefix(w[])
  650. {
  651.     if (w[0] == 0) return;
  652.     if (contain(w, "weapon_") == 0)
  653.         copy(w, 23, w[7]); // "weapon_xxx" -> "xxx"
  654. }
  655.  
  656. stock reset_roundstats_client(i)
  657. {
  658.     g_kills[i]=0; g_hs[i]=0; g_dmg[i]=0.0; g_shots[i]=0; g_hits[i]=0;
  659. }
  660. stock reset_perlife(i)
  661. {
  662.     for (new j=1;j<MAXP;j++)
  663.     {
  664.         g_dmgFrom[j][i]=0.0; g_hitsFrom[j][i]=0; g_lastWeap[j][i][0]=0;
  665.         g_dmgFrom[i][j]=0.0; g_hitsFrom[i][j]=0; g_lastWeap[i][j][0]=0;
  666.     }
  667. }
  668. stock reset_totals_round()
  669. {
  670.     g_tKills[2]=g_tKills[3]=0;
  671.     g_tHS[2]=g_tHS[3]=0;
  672.     g_tShots[2]=g_tShots[3]=0;
  673.     g_tHits[2]=g_tHits[3]=0;
  674. }
  675. stock reset_totals(){ reset_totals_round(); }
  676.  
  677. stock sort_by_dmg(arr[], cnt, bool:desc, pivot)
  678. {
  679.     for (new i=0;i<cnt-1;i++)
  680.     {
  681.         new best=i;
  682.         for (new j=i+1;j<cnt;j++)
  683.         {
  684.             new a = arr[j], b = arr[best];
  685.             new Float:da = (pivot>0) ? g_dmgFrom[a][pivot] : g_dmgFrom[-pivot][a];
  686.             new Float:db = (pivot>0) ? g_dmgFrom[b][pivot] : g_dmgFrom[-pivot][b];
  687.             if (desc ? (da>db) : (da<db)) best=j;
  688.         }
  689.         if (best!=i){ new t=arr[i]; arr[i]=arr[best]; arr[best]=t; }
  690.     }
  691. }
  692.  
  693. // -------------------- Clutch / Duel --------------------
  694. check_clutch_state()
  695. {
  696.     new tAlive=0, ctAlive=0, loneT=0, loneCT=0;
  697.     for (new i=1;i<MAXP;i++)
  698.     {
  699.         if (!is_user_connected(i) || !is_user_alive(i)) continue;
  700.         new tm = get_user_team(i);
  701.         if (tm==1){ tAlive++; loneT=i; }
  702.         else if (tm==2){ ctAlive++; loneCT=i; }
  703.     }
  704.  
  705.     // 1v1
  706.     if (tAlive==1 && ctAlive==1)
  707.     {
  708.         if (!g_ann1v1)
  709.         {
  710.             new tn[32], cn[32];
  711.             get_user_name(loneT, tn, charsmax(tn));
  712.             get_user_name(loneCT, cn, charsmax(cn));
  713.             new thp=get_user_health(loneT), chp=get_user_health(loneCT);
  714.  
  715.             new r,g,b; rand_bright(r,g,b);
  716.             center_all(r,g,b, 2.6, "%s (%d hp)  VS  %s (%d hp)", cn, chp, tn, thp);
  717.  
  718.             spk_all(SND_DUEL1V1);
  719.             g_ann1v1 = true;
  720.             g_ann1vX = true;
  721.         }
  722.         return;
  723.     }
  724.  
  725.     // 1vX
  726.     if (!g_ann1vX)
  727.     {
  728.         if (ctAlive==1 && tAlive>=2)
  729.         {
  730.             new nm[32]; get_user_name(loneCT, nm, charsmax(nm));
  731.             new hp = get_user_health(loneCT);
  732.             new r,g,b; rand_bright(r,g,b);
  733.             center_all(r,g,b, 2.6, "%s (%d hp)  vs  %d Terrorista. A csapatod elveszett...", nm, hp, tAlive);
  734.             spk_all(SND_CLUTCH);
  735.             g_ann1vX=true; return;
  736.         }
  737.         if (tAlive==1 && ctAlive>=2)
  738.         {
  739.             new nm2[32]; get_user_name(loneT, nm2, charsmax(nm2));
  740.             new hp2 = get_user_health(loneT);
  741.             new r2,g2,b2; rand_bright(r2,g2,b2);
  742.             center_all(r2,g2,b2, 2.6, "%s (%d hp)  vs  %d CT. A csapatod elveszett...", nm2, hp2, ctAlive);
  743.             spk_all(SND_CLUTCH);
  744.             g_ann1vX=true; return;
  745.         }
  746.     }
  747. }

Oldal: 1 / 1 Minden időpont UTC+01:00 időzóna szerinti
Powered by phpBB® Forum Software © phpBB Limited
https://www.phpbb.com/