sprawdź
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#define PLUGIN "Jail Break: Bunt wiezniow - sekundy"
#define VERSION "1.0"
#define AUTHOR "Sn!ff3r"
new cvar_time
new Float:roundtime
new g_msgsync;
new countdown_timer
const TASK_ID = 1603;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR)
cvar_time = register_cvar("jail_czasbuntu", "30")
register_logevent("round_start", 2, "1=Round_Start")
register_event("HLTV", "event_round_start", "a", "1=0", "2=0");
RegisterHam(Ham_TakeDamage, "player", "client_damage")
g_msgsync = CreateHudSyncObj();
}
public round_start()
{
roundtime = get_gametime()
}
public event_round_start()
{
remove_task(TASK_ID);
countdown_timer = get_cvar_num("jail_czasbuntu") - 1;
set_task(4.0, "countdown", TASK_ID);
}
public countdown()
{
if (countdown_timer > 1)
{
set_hudmessage(179, 0, 0, -1.0, 0.28, 2, 0.02, 1.0, 0.01, 0.1, 10);
if (countdown_timer != 1)
ShowSyncHudMsg(0, g_msgsync, "Do buntu pozostało %i", countdown_timer-1);
}
--countdown_timer;
if(countdown_timer >= 1)
set_task(1.0, "countdown", TASK_ID);
else
remove_task(TASK_ID);
}
public client_damage(victim, entid, attacker, Float:damage, damagebits)
{
if(get_user_team(attacker) == 1 && get_user_team(victim) == 2)
{
static Float:nowtime, timer
nowtime = get_gametime()
timer = get_pcvar_num(cvar_time)
if((nowtime - roundtime) < float(timer))
{
client_print(attacker, print_chat, "Nie mozesz jeszcze rozpoczac buntu!")
return HAM_SUPERCEDE
}
}
return HAM_IGNORED
}