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

#define PLUGIN "[JB] Wojna Na Granaty"
#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 Granaty");
}

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

public OnRemoveData(day)
{
    jail_set_ct_hit_tt(false);
    jail_set_god_ct(false);
    server_cmd("sv_gravity 800");
}

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 nawzajem zabijaja sie granatami.", szTime, szTime);
        szInfo = "Dzisiaj jest Wojna Na Granaty";
        
        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);
        server_cmd("sv_gravity 500");
        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_hegrenade");
            cs_set_user_bpammo(i, CSW_HEGRENADE, 999)
        }
    }
}

//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);
    }
}
/* AMXX-Studio Notes - DO NOT MODIFY BELOW HERE
*{\\ rtf1\\ ansi\\ deff0{\\ fonttbl{\\ f0\\ fnil Tahoma;}}\n\\ viewkind4\\ uc1\\ pard\\ lang1045\\ f0\\ fs16 \n\\ par }
*/
