// plugin_timerem.sma, v 1.0.0.0 04/08/01 
 
#include <core>
#include <console>
#include <string>
#include <admin>
#include <adminlib>
 
new STRING_VERSION[MAX_DATA_LENGTH] = "1.0.0.0";
 
public execute_all(a[]) {
    new username[200];
    new i=0;
    new x = 0;
 
    x = maxplayercount();
    for(i=1; i<=x; i=i+1) {
        strinit(username);
        if(playerinfo(i, username, 200)==1) {
            execclient(username, a);
        }
    }
}
 
/* general warning messages fired off by timer (launched in client_start) */
public warn1() {
    execute_all("speak ^"fvox/sixty seconds remaining^"");
}
 
public warn5() {
    execute_all("speak ^"fvox/five minutes remaining^"");
}
 
public warn10() {
    execute_all("speak ^"fvox/ten minutes remaining^"");
}
 
public warn20() {
    execute_all("speak ^"fvox/twenty minutes remaining^"");
}
 
public plugin_init() {
    plugin_registerinfo("Time Remaining Announcer","Announces time remaining automatically",STRING_VERSION);
 
    /* start timers for "time remaining" warnings */
    new time1=timeleft();
    set_timer("warn20", time1 - 1200, 0);
    set_timer("warn10", time1 - 600, 0);
    set_timer("warn5", time1 - 300, 0);
    set_timer("warn1", time1 - 60, 0);
 
    return PLUGIN_CONTINUE;
}