
/* AMX Mod script. 
* 
* (c) Copyright 2002, KkkkkkTzs 
* This file is provided as is (no warranties). 
* 
*/	

#include <amxmod> 

new notsendCT = 0 // mark that we have send the sound
new notsendT = 0  // mark that we have send the sound

public death_msg(id){
	new players_ct[32], players_t[32], ict, ite 
	get_players(players_ct,ict,"ae","CT")	
	get_players(players_t,ite,"ae","TERRORIST")	

	new victim = read_data(2)
	new victim_team = get_user_team(victim,"",0)

	if (victim_team == 1 && ite > 0)
		notsendT = 1  // mark that we have not send the sound
	else if ((victim_team == 2 || victim_team == 4) && ict > 0)
		notsendCT = 1 // mark that we have not send the sound
	
	if (ict==1&&ite==1){
		new name[32]
		get_user_name(players_ct[0],name,32)
		set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
		show_hudmessage(players_t[0],"You and %s left!",name)

		get_user_name(players_t[0],name,32)
		set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
		show_hudmessage(players_ct[0],"You and %s left!",name)

		if (notsendT) client_cmd(players_t[0],"spk ^"vox/_period _period your the last man^"")
		if (notsendCT) client_cmd(players_ct[0],"spk ^"vox/_period _period your the last man^"")
		notsendT = 0 // mark that we have send the sound
		notsendCT = 0 // mark that we have send the sound
	}
	else if (ict==1&&notsendCT){
		set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
		show_hudmessage(players_ct[0],"Only you against %i Terrorists!",ite)
		client_cmd(players_ct[0],"spk ^"vox/_period _period your the last man^"")
		notsendCT = 0 // mark that we have send the sound
	}
	else if (ite==1&&notsendT){
		set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
		show_hudmessage(players_t[0],"Only you against %i CT!",ict)
		client_cmd(players_t[0],"spk ^"vox/_period _period your the last man^"")
		notsendT = 0 // mark that we have send the sound
	}
	return PLUGIN_CONTINUE	
}
public plugin_init(){
	register_plugin("Last Man 2","0.7","default")
	register_event("DeathMsg","death_msg","a")
	return PLUGIN_CONTINUE	
}

