Try this:
PHP Code:
#include <amxmodx>
#include <amxmisc>
#include <hamsandwich>
#include <engine>
#include <fakemeta>
#define PLUGIN "Countdown - Glass"
#define VERSION "1.0"
#define AUTHOR "Xalus"
#define ACCESS ADMIN_KICK
new cCountdown;
new Float:g_fStartTime;
public plugin_init() {
register_plugin(PLUGIN, VERSION, AUTHOR)
/* Cvar */
cCountdown = register_cvar("countdown_status", "10");
/* Say Commands */
register_clcmd("say /countdown", "Handler");
register_clcmd("say countdown", "Handler");
}
/*
CountDown Glass:
- Handler
*/
public Handler(id) {
if(get_user_flags(id) & ACCESS) {
g_fStartTime = get_gametime()
StartCountdown()
}
}
/*
CountDown Glass:
- CountDown
*/
public StartCountdown() {
new Float:fRemainingTime = (get_gametime() - g_fStartTime)
if(get_pcvar_float(cCountdown) <= fRemainingTime) {
client_cmd(0 , "spk radio/com_go")
new ent = 0
while((ent = find_ent_by_class(ent,"func_breakable")) != 0) {
new target[32]; pev(ent, pev_targetname, target, 31);
if(equal(target, "breakable")) {
ExecuteHamB( Ham_TakeDamage, ent, 0, 0, 9999.0, DMG_GENERIC )
}
}
} else {
new Time = floatround(get_pcvar_float(cCountdown) - fRemainingTime)
new szTime[32]
num_to_word(Time, szTime, 31)
if(Time <= 10)
if(Time)
client_cmd(0,"speak ^"vox/%s^"", szTime)
set_hudmessage(random(255), random(255), random(255), -1.0, 0.05, 0, 6.0, 1.0, 0.0, 0.0, -2);
show_hudmessage(0, "[Glass Break in: %d Seconds]", Time)
// timer
set_task(1.0, "StartCountdown")
}
return PLUGIN_CONTINUE;
}
__________________