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

#include <amxmod> 
#define MESSAGES 4

new messages[MESSAGES][] = {"Now all depend on you!",
"I hope you still have a healthpack.",
"All your teammates were killed. Good luck!",
"Now you are alone. Have fun!"}

new alone_ann = 0

public roundend_msg(id)
   alone_ann = 0

public death_msg(id){
   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(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
      show_hudmessage(0,"%s vs. %s",name1,name2)
      client_cmd(0,"spk misc/maytheforce")
   }
   else {   
      if (ict==1&&ite>1&&alone_ann==0){
         last=players_ct[0]
         client_cmd(last,"spk misc/oneandonly")
      }
      else if (ite==1&&ict>1&&alone_ann==0){
         last=players_t[0]
         client_cmd(last,"spk misc/oneandonly")
      }
      else {
         return PLUGIN_CONTINUE
      }
      alone_ann = last
      new name[32]   
      get_user_name(last,name,32)
      set_hudmessage(200, 100, 0, -1.0, 0.30, 0, 6.0, 6.0, 0.5, 0.15, 1)
      show_hudmessage(0,"%s: %s",name, messages[ random_num(0,MESSAGES-1) ] )
      client_cmd(last,"spk misc/maytheforce")
   }
   return PLUGIN_CONTINUE   
}

public plugin_init(){
	register_plugin("Last Man","0.6","ToT|V!PER version")
	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")
	register_event("DeathMsg","death_msg","a")
	return PLUGIN_CONTINUE   
}   

