#include <amxmodx>
#include <amxmisc>
#include <fun>
#include <engine>
#include <jailbreak>
#include <cstrike>

#define PLUGIN "[JB] Wojna Na Plazmy"
#define VERSION "1.0.6"
#define AUTHOR "Wielkie Jol"

new id_zabawa;

public plugin_init() {
	register_plugin(PLUGIN, VERSION, AUTHOR)
	
	id_zabawa = jail_register_game("Wojna Na Plazmy!");
}

public OnLastPrisonerShowWish(id)
{
	OnRemoveData(id_zabawa);
}

public OnRemoveData(day)
{
	jail_set_ct_hit_tt(false);
	jail_set_god_ct(false);
}

public OnDayStartPre(day, szInfo[256], szInfo2[512], setting[10], gTimeRound)
{    
	static szTime[12];
	if(day == id_zabawa)
	{
		format_time(szTime, 11, "%M:%S", gTimeRound-30);
		formatex(szInfo2, 511, "Zasady:^n%s - Terrorysci dostaja plazmy i sie zabijaja.", szTime, szTime);
		szInfo = "Plazma Dej";
		
		setting[0] = 1;
		setting[1] = 1;
		setting[2] = 1;
		setting[4] = 1;
		setting[7] = 2;
	}
}

public OnDayStartPost(day)
{
	if(day == id_zabawa)
	{
		jail_set_ct_hit_tt(true);
		jail_set_god_ct(true);
		jail_open_cele();
		jail_set_game_hud(30, "Rozpoczecie zabawy za");
		
	}
}

public OnGameHudEnd(day)
{
	if(day == id_zabawa)
	{
		jail_set_prisoners_fight(true, false, false);
		for(new i=1; i<=MAX; i++){
			if(!is_user_alive(i) || cs_get_user_team(i) != CS_TEAM_T)
				continue;
			give_item(i, "weapon_ump45");
			server_cmd("jail_add_plazma %d", i);
		}
	}
}

//stock
stock jail_set_all_speed(Float:speed, team)
{
	for(new i=1; i<=MAX; i++)
	{
		if(!is_user_alive(i) || !is_user_connected(i) || get_user_team(i) != team)
			continue;
		
		jail_set_user_speed(i, speed);
	}
}
