Using Auto Power-on & shutdown program which schedule when you want your computer to hibernate/sleep and power-on specific time.
So I need this plugin to notify/warn all players on the server.
But I'm lost in this mess and couldn't find the original thread I got this script from which Alka posted, all I request is someone kind a couple of minutes willing to fix this.
This is supposed to countdown when it have reach %H, %M and < (less than) 60 seconds remaining.
It should countdown even on map changes.
The computer goes into hibernation:
Monday, Tuesday, Wednesday, Thursday, Sunday --> 01:00:00
Friday, Saturday --> 03:00:00
Code:
#include <amxmodx>
#define PLUGIN "New Plugin"
#define VERSION "1.0"
#define AUTHOR "Alka"
static szTime[10];
static szTemp[3][6];
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
set_task(1.0, "taskCheckTime", 0, "", 0, "b", 0);
}
public taskCheckTime()
{
get_time("%H:%M:%S", szTime, sizeof szTime - 1);
str_piece(szTime, szTemp, sizeof szTemp, sizeof szTemp[] - 1, ':');
if((str_to_num(szTemp[0]) == 03) && (str_to_num(szTemp[1]) == 00) && (str_to_num(szTemp[2]) < 60))
{
set_task(1.0, "count_start", .flags="b");
return PLUGIN_HANDLED;
}
return PLUGIN_HANDLED;
}
public count_start(id)
{
get_time("%H:%M:%S", szTime, sizeof szTime - 1);
str_piece(szTime, szTemp, sizeof szTemp, sizeof szTemp[] - 1, ':');
if(str_to_num(szTemp[2]) < 60)
client_print(0, print_center, "Shutting down in %d seconds\nServer is back up at 10 AM (GMT +1), See ya!", blah...blah);
if(str_to_num(szTemp[2]) == 2)
client_cmd(0, "spk barney/seeya");
if(str_to_num(szTemp[2]) == 0)
client_print(0, print_chat, "The End");
}
stock str_piece(const input[], output[][], outputsize, piecelen, token = '|')
{
new i = -1, pieces, len = -1 ;
while ( input[++i] != 0 )
{
if ( input[i] != token )
{
if ( ++len < piecelen )
output[pieces][len] = input[i] ;
}
else
{
output[pieces++][++len] = 0 ;
len = -1 ;
if ( pieces == outputsize )
return pieces ;
}
}
return pieces + 1;
}