The time is 24hr time so 12am is 0.
PHP Code:
#include <amxmodx>
#include <amxmisc>
#define PLUGIN "Happy Hour"
#define VERSION "1.0"
#define AUTHOR "bugsy"
new bool: g_bHappyHour;
new g_pHappyHourStart;
new g_pHappyHourEnd;
new g_pHappyHourInterval;
public plugin_init()
{
register_plugin(PLUGIN, VERSION, AUTHOR);
g_pHappyHourStart = register_cvar( "hh_start" , "0" );
g_pHappyHourEnd = register_cvar( "hh_end" , "6" );
g_pHappyHourInterval = register_cvar( "hh_interval" , "15.0" );
}
public plugin_cfg()
{
set_task( get_pcvar_float( g_pHappyHourInterval ) , "CheckTime" , 1921 , _,_,"b");
}
public CheckTime()
{
static iHour, iEnd;
iEnd = get_pcvar_num( g_pHappyHourEnd );
time( iHour ,_,_);
if ( !g_bHappyHour && ( get_pcvar_num( g_pHappyHourStart ) <= iHour < iEnd ) )
{
g_bHappyHour = true;
//Enable your happy hour code here
}
else if ( g_bHappyHour && ( iHour >= iEnd ) )
{
g_bHappyHour = false;
//Disable your happy hour code here
}
}
__________________