#include <amxmodx>
#include <amxmisc>
#include <cstrike>
new ct=0;
new tt=0;
new win_t =0;
new win_ct = 0;
new all_raund=0;
new str_t[10];
new str_ct[10];
new str_all[10];
new str_win_t[10];
new str_win_ct[10];
public plugin_init()
{
register_plugin("Team Score", "1.1.0", "so1l & Radius");
set_task(0.2,"show",_,_,_,"b");
set_task(0.1, "player_alive",_, _, _, "b");
// Событие победы терроров
register_event("SendAudio", "t_win", "a", "2&%!MRAD_terwin");
//Событие победы контров
register_event("SendAudio", "ct_win", "a", "2&%!MRAD_ctwin");
//Событие - ничья
register_event("SendAudio", "draw", "a", "2&%!MRAD_rounddraw");
//Для случая рестарта
register_event("TextMsg", "eRestart", "a", "2=#Game_will_restart_in","2=#Game_Commencing");
}
public eRestart()
{
win_t=0;
win_ct=0;
all_raund=0;
}
public t_win()
{
win_t++;
all_raund++;
}
public ct_win()
{
win_ct++;
all_raund++;
}
public draw()
{
all_raund++;
}
public show()
{
str_t=" ";
str_ct=" ";
str_all=" ";
str_win_t=" ";
str_win_ct=" ";
//Проверка КТ
if(ct<10)
format(str_ct,2,"0%d",ct);
else
format(str_ct,2,"%d",ct);
//Проверка ТТ
if(tt<10)
format(str_t,2,"0%d",tt);
else
format(str_t,2,"%d",tt);
//Получем кол раундов.
if(all_raund < 10)
format(str_all,2,"0%d",all_raund);
else
format(str_all,2,"%d",all_raund);
//сколько побед у ТТ
if(win_t<10)
format(str_win_t,2,"0%d",win_t);
else
format(str_win_t,2,"%d",win_t);
//Сколько побед у КТ
if(win_ct<10)
format(str_win_ct,2,"0%d",win_ct);
else
format(str_win_ct,2,"%d",win_ct);
new str1[20];
format(str1,20,"%s Победы %s",str_win_t,str_win_ct);
for(new id=0;id<=32;id++)
{
if(!is_user_connected(id))
{
continue;
}
set_dhudmessage(255, 0, 0, 0.42, 0.0, 0 , 0.0, 0.1,0.1,0.1);
show_dhudmessage(id, "TR %s",str_t);
set_dhudmessage(0, 200, 75, 0.42, 0.0, 0, 0.0, 0.1,0.1,0.1);
show_dhudmessage(id, " [%s]",str_all);
set_dhudmessage(9, 0, 255, 0.42, 0.0, 0, 0.0, 0.1,0.1,0.1);
show_dhudmessage(id, " %s CT",str_ct);
set_dhudmessage(0, 200, 75, 0.42, 0.03, 0, 0.0, 0.1,0.1,0.1);
show_dhudmessage(id, " %s", str1);
}
}
public player_alive()
{
ct=0;
tt=0;
for(new id =0;id< 33;id++)
{
if(!is_user_connected(id))
{
continue;
}
else if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_CT)
{
ct++;
}
else if(is_user_alive(id) && cs_get_user_team(id) == CS_TEAM_T)
{
tt++;
}
}
}