Raised This Month: $ Target: $400
 0% 

Simple doubt about getting time.


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 05-26-2009 , 22:54   Re: Simple doubt about getting time.
Reply With Quote #3

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 boolg_bHappyHour;
new 
g_pHappyHourStart;
new 
g_pHappyHourEnd;
new 
g_pHappyHourInterval;

public 
plugin_init() 
{
    
register_plugin(PLUGINVERSIONAUTHOR);
    
    
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_taskget_pcvar_floatg_pHappyHourInterval ) , "CheckTime" 1921 _,_,"b");
}

public 
CheckTime()
{
    static 
iHouriEnd;

    
iEnd get_pcvar_numg_pHappyHourEnd );
    
timeiHour ,_,_);
    
    if ( !
g_bHappyHour && ( get_pcvar_numg_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
    
}

__________________

Last edited by Bugsy; 05-27-2009 at 01:23.
Bugsy is offline
 



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 01:25.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode