#include <amxmodx>
#include <amxmisc>
 
#define PLUGIN_NAME "Ultimate KillStreak Advanced"
#define PLUGIN_VERSION "1.0"
#define PLUGIN_AUTHOR "Dizzy" 
 
 
new lastman_mode;
new alone_ann = 0;
new kills[33] = {0,...};
new deaths[33] = {0,...};
new kill[33][24];
 
#define LEVELS 13
#define hsounds 14
#define knsounds 2
#define prpsounds 4
#define maxdbsounds 2
#define TASK_CLEAR_KILL    100
 
new hsenable
new knifeenable
new cvardouble
new rnstartcvar
new killstreaktype
 
 
new levels[13] = {3,4,5,6,7,8,9,10,11,13,15,18,20};
 
new sounds[13][] = 
{
"sound/oneshootsounds/1", 
"sound/oneshootsounds/2", 
"sound/oneshootsounds/3",
"sound/oneshootsounds/4", 
"sound/oneshootsounds/5", 
"sound/oneshootsounds/6",
"sound/oneshootsounds/7",
"sound/oneshootsounds/8",
"sound/oneshootsounds/9",
"sound/oneshootsounds/10",
"sound/oneshootsounds/11",
"sound/oneshootsounds/12",
"sound/oneshootsounds/13"
};
 
new messages[13][] = 
{
"%s: 1.szint: 3 kill Tripla Kill !!!", 
"%s: 2.szint: 4 kill Multi Kill !!!",
"%s: 3.szint: 5 kill Ultra Kill !!!", 
"%s: 4 szint: 6 kill Mega Kill !!!",
"%s: 5.szint: 8 kill Tombol !!!",
"%s: 6.szint: 9 kill Gyilkologe'p !!! ",
"%s: 7.szint: 10 kill Hihetetlen !!!", 
"%s: 8.szint: 11 kill Szörnyeteg !!!",
"%s: 9.szint: 12 kill Szent szar !!!", 
"%s: 10.szint: 13 kill Isteni !!!", 
"%s: +11 szint: 15 kill Isten vagy !!!",
"%s: +12 szint: 18 kill Legyozhetetlen !!!",
"%s: +13 szint: 20 kill Ki'raly vagy !!!"
};
 
new hslist[hsounds][] = 
{
"sound/oneshootsounds/hs1",
"sound/oneshootsounds/hs2",
"sound/oneshootsounds/hs3",
"sound/oneshootsounds/hs4",
"sound/oneshootsounds/hs5",
"sound/oneshootsounds/hs6",
"sound/oneshootsounds/hs7",
"sound/oneshootsounds/hs8",
"sound/oneshootsounds/hs9",
"sound/oneshootsounds/hs10",
"sound/oneshootsounds/hs11",
"sound/oneshootsounds/hs12",
"sound/oneshootsounds/hs13",
"sound/oneshootsounds/hs14"
 
}
 
 
new preplist[prpsounds][]=
{
"sound/oneshootsounds/prepare1",
"sound/oneshootsounds/prepare2",
"sound/oneshootsounds/prepare3",
"sound/oneshootsounds/prepare4"
}
 
 
 
 
 
new hsmessages[4][]=
{
"%s leszedte %s fejét !!",
"%s hihetetlen fejest adott %s-nak !",
"%s -tol kapott egy gyonyoru HEADSHOT-ot %s!",
"%s adott %s -nek egy  super headshotot !"
}
 
new knlist[knsounds][]=
{
"sound/oneshootsounds/knife1",
"sound/oneshootsounds/knife2"
}
 
new knmessages[3][]=
{
"%s ledofte %s",
"%s felszabdalta a ke'se'vel %s",	
"%s lekeselte %s"
}
 
 
new doublelist[maxdbsounds][]=
{
"sound/oneshootsounds/doublekill1",
"sound/oneshootsounds/doublekill2"
}
 
new messagesnohp[5][]= 
{
 
"%i terrorist vs %i CT^n%s: Sza'mitunk ra'd haver el ne baszd!",
"%i terrorist vs %i CT^n%s: Reme'lem van na'lad e'letmento csomag",
"%i terrorist vs %i CT^n%s: Kinyirta'k a csapta'rsaid.Sok szerencse't!",
"%i terrorist vs %i CT^n%s: Te vagy az utolso reme'nyunk!",
"%i terrorist vs %i CT^n%s: Most egyedul vagy.Jo szorakozast!"
}
 
new messageshp[5][]= 
{
 
"%i terrorist vs %i CT^n%s (%i hp): Sza'mitunk ra'd haver el ne baszd!",
"%i terrorist vs %i CT^n%s (%i hp): Reme'lem van na'lad e'letmento csomag",
"%i terrorist vs %i CT^n%s (%i hp): Kinyirta'k a csapta'rsaid.Sok szerencse't!",
"%i terrorist vs %i CT^n%s (%i hp): Te vagy az utolso reme'nyunk!",
"%i terrorist vs %i CT^n%s (%i hp): Most egyedul vagy.Jo szorakozast!"
 
}
 
is_mode_set(bits) {
    new mode[9];
    get_cvar_string("ut_killstreak_advanced", mode, 8);
    return read_flags(mode) & bits;
}
 
public plugin_init() {
    register_plugin(PLUGIN_NAME, PLUGIN_VERSION, PLUGIN_AUTHOR);
    killstreaktype = register_cvar("ut_killstreak_advanced", "3");
    register_event("ResetHUD", "reset_hud", "b");
    register_event("HLTV","rnstart","a", "1=0", "2=0");
    register_event("DeathMsg", "event_death", "a");
    hsenable = register_cvar("ut_killstreak_hs","1");
    knifeenable = register_cvar("ut_killstreak_knife","1");
    cvardouble = register_cvar("ut_doublekill_events","1");
    rnstartcvar = register_cvar("ut_roundcout_sounds","1");
    register_event("DeathMsg","death_msg","a");
    register_event("SendAudio","roundend_msg","a","2=%!MRAD_terwin","2=%!MRAD_ctwin","2=%!MRAD_rounddraw");
    register_event("TextMsg","roundend_msg","a","2&#Game_C","2&#Game_w");
    lastman_mode = register_cvar("lastman_mode","abc")
 
    return PLUGIN_CONTINUE;
}
 
 
public event_death(id) {
    new killer = read_data(1);
    new victim = read_data(2);
    new headshot = read_data(3);
    new weapon[24], vicname[32], killname[32]
    read_data(4,weapon,23)
    get_user_name(victim,vicname,31)
    get_user_name(killer,killname,31)
 
 
 
    if(headshot == 1 && get_pcvar_num(hsenable) ==1) 
    { 
	set_hudmessage(255, 255, 255, -1.0, 0.25, 0, 2.0, 2.0)
	show_hudmessage(0, (hsmessages[random_num(0,3)]), killname, vicname)
	new i
	i = random_num(0,hsounds-1)
	client_cmd(0,"mp3 play %s",hslist[i])
    } 
 
 
    if(weapon[0] == 'k'  && get_pcvar_num(knifeenable) ==1)
    { 
    	set_hudmessage(255, 255, 255, -1.0, 0.25, 0, 2.0, 2.0)
    	show_hudmessage(0, (knmessages[random_num(0,2)]), killname, vicname)
        new r
	r = random_num(0,knsounds-1)
	client_cmd(0,"mp3 play %s",knlist[r])   
    } 
 
 
 
 
 
 
    if(kill[killer][0] && equal(kill[killer],weapon) && get_pcvar_num(cvardouble) == 1)
    {
        set_hudmessage(0, 200, 0, -1.0, 0.25, 0, 2.0, 2.0)
	show_hudmessage(0,"OMG %s Szep Dupla oles", killname)
        kill[killer][0] = 0;
        new q
        q= random_num(0,maxdbsounds-1)
        client_cmd(0,"mp3 play %s",doublelist[q])
    }
 
    else
    {
        kill[killer] = weapon;
        set_task(0.1,"clear_kill",TASK_CLEAR_KILL+killer);
    }
 
 
 
    kills[killer] += 1;
    kills[victim] = 0;
    deaths[killer] = 0;
    deaths[victim] += 1;
 
    for (new i = 0; i < LEVELS; i++) 
    {
        if (kills[killer] == levels[i]) 
	{
            announce(killer, i);
            return PLUGIN_CONTINUE;
        }
    }
 
    return PLUGIN_CONTINUE;
}
 
announce(killer, level) 
{
 
    new name[33]
 
    get_user_name(killer, name, 32);
    set_hudmessage( 0, 255, 0, 0.05, 0.65, 0, 3.0, 3.0, 0.01, 0.1, 2);
 
    if( (get_pcvar_num(killstreaktype) <= 0 ) || get_pcvar_num(killstreaktype) > 3)
    return PLUGIN_HANDLED;
 
 
 
    if(get_pcvar_num(killstreaktype) == 1)
    {
    	show_hudmessage(0, messages[level], name);
    }
 
    if(get_pcvar_num(killstreaktype) == 2)
    {
	client_cmd(0, "mp3 play %s", sounds[level]);
    }
 
    if(get_pcvar_num(killstreaktype) == 3)
    {
	show_hudmessage(0, messages[level], name);
	client_cmd(0, "mp3 play %s", sounds[level]);
    }
 
    return PLUGIN_CONTINUE;
 
}
 
 
public reset_hud(id) 
{
    if (is_mode_set(16)) {
      if (kills[id] > levels[0]) {
        client_print(id, print_chat, 
                     "* Egymas utan %d oles ", kills[id]);
      } else if (deaths[id] > 1) {
        client_print(id, print_chat, 
                     "* Ma'r %d halalod volt egymas utan.", deaths[id]);
 
        }
    }
}
 
public rnstart(id)
{
    if(get_pcvar_num(rnstartcvar) == 1)
    {  
    set_hudmessage(0, 0, 255, -1.0, 0.30, 0, 6.0, 6.0)
    show_hudmessage(0, "Keszulj fel a harcra!")
    new q
    q = random_num(0,prpsounds-1)
    client_cmd(0,"mp3 play %s",preplist[q])
    }
}
 
public client_connect(id) {
    kills[id] = 0;
    deaths[id] = 0;
}
 
public clear_kill(taskid)
 {
    new id = taskid-TASK_CLEAR_KILL;
    kill[id][0] = 0;
 }
 
public roundend_msg(id)
 
	alone_ann = 0
 
public death_msg(id)
{
 
	new lmmode[8] 
	get_pcvar_string(lastman_mode,lmmode,8) 
	new lmmode_bit = read_flags(lmmode)
 
	new players_ct[32], players_t[32], ict, ite, last
	get_players(players_ct,ict,"ae","CT")   
	get_players(players_t,ite,"ae","TERRORIST")   
 
	if (ict==1&&ite==1)
	{
		new name1[32], name2[32]
		get_user_name(players_ct[0],name1,32)
		get_user_name(players_t[0],name2,32)
		set_hudmessage(0, 255, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
 
		if (lmmode_bit & 1)
		{
			if (lmmode_bit & 2)
			{
				show_hudmessage(0,"%s (%i hp) vs. %s (%i hp)",name1,get_user_health(players_ct[0]),name2,get_user_health(players_t[0]))
			}
 
			else
			{
				show_hudmessage(0,"%s vs. %s",name1,name2)
			}
 
			if (lmmode_bit & 4)
			{
				for(new i=1;i<=get_maxplayers();i++) 
					if( is_user_connected(i) == 1 )
						client_cmd(i,"mp3 play sound/oneshootsounds/maytheforce")
			}
		}
	} 
	else
{   
	if (ict==1&&ite>1&&alone_ann==0&&(lmmode_bit & 4))
	{
		last=players_ct[0]
		client_cmd(last,"mp3 play sound/oneshootsounds/oneandonly")
 
	}
 
	else if (ite==1&&ict>1&&alone_ann==0&&(lmmode_bit & 4))
	{
		last=players_t[0]
		client_cmd(last,"mp3 play sound/ultimatesound/oneandonly")
	}
 
	else
	{
		return PLUGIN_CONTINUE
	}
	alone_ann = last
	new name[32]   
	get_user_name(last,name,32)
 
	if (lmmode_bit & 1)
	{
		set_hudmessage(0, 255, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
 
		if (lmmode_bit & 2)
		{
			show_hudmessage(0, messageshp[ random_num(0,5) ],ite ,ict ,name,get_user_health(last))
		}
 
		else
		{
			show_hudmessage(0, messagesnohp[ random_num(0,5) ],ite ,ict ,name )
		}
	}
 
}
	return PLUGIN_CONTINUE   
} 
public plugin_precache()
{
precache_sound("oneshootsounds/1.mp3")
precache_sound("oneshootsounds/2.mp3")
precache_sound("oneshootsounds/3.mp3")
precache_sound("oneshootsounds/4.mp3")
precache_sound("oneshootsounds/5.mp3")
precache_sound("oneshootsounds/6.mp3")
precache_sound("oneshootsounds/7.mp3")
precache_sound("oneshootsounds/8.mp3")
precache_sound("oneshootsounds/9.mp3")
precache_sound("oneshootsounds/11.mp3")
precache_sound("oneshootsounds/12.mp3")
precache_sound("oneshootsounds/hs1.mp3")
precache_sound("oneshootsounds/hs2.mp3")
precache_sound("oneshootsounds/hs3.mp3")
precache_sound("oneshootsounds/hs4.mp3")
precache_sound("oneshootsounds/hs5.mp3")
precache_sound("oneshootsounds/hs6.mp3")
precache_sound("oneshootsounds/hs7.mp3")
precache_sound("oneshootsounds/hs8.mp3")
precache_sound("oneshootsounds/hs9.mp3")
precache_sound("oneshootsounds/hs10.mp3")
precache_sound("oneshootsounds/hs11.mp3")
precache_sound("oneshootsounds/hs12.mp3")
precache_sound("oneshootsounds/hs13.mp3")
precache_sound("oneshootsounds/hs14.mp3")
precache_sound("oneshootsounds/knife1.mp3")
precache_sound("oneshootsounds/knife2.mp3")
precache_sound("oneshootsounds/prepare1.mp3")
precache_sound("oneshootsounds/prepare2.mp3")
precache_sound("oneshootsounds/prepare3.mp3")
precache_sound("oneshootsounds/prepare4.mp3")
precache_sound("oneshootsounds/doublekill1.mp3")
precache_sound("oneshootsounds/doublekill2.mp3")
}