Raised This Month: $ Target: $400
 0% 

Doing something on specific date-time


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 09-20-2011 , 08:49   Re: Doing something on specific date-time
Reply With Quote #2

i made an entity wich thinks every minute to check time then a stock to return your specified 12 hour day time..


PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <amxmisc>
#include <engine>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"

#define MINUTE_IN_SEC        60

new const gEntityClassname[ ] = "_Thinker.";
new const 
gSpecifiedTime[ ] = "3:00 PM";

public 
plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
    
// Add your code here...
    
UTIL_CreateThinker( );
    
register_thinkgEntityClassname"forward_Thinker" );
}

public 
forward_ThinkeriEnt )
{
    if( 
pev_validiEnt ) )
    {
        
set_peviEntpev_nextthinkget_gametime( ) + MINUTE_IN_SEC );
        
        if( 
UTIL_GetSpecifiedTime( ) )
        {
            
// it's your time do your thing
        
}
    }
}

stock UTIL_CreateThinker( )
{
    new 
iEnt create_entity"info_target" );
        
    if( !
pev_validiEnt ) )
    {
        return 
PLUGIN_HANDLED;
    }
    
    
set_peviEntpev_classnamegEntityClassname );
    
set_peviEntpev_nextthinkget_gametime( ) + MINUTE_IN_SEC );
    
    return 
PLUGIN_HANDLED;
}

stock UTIL_GetSpecifiedTime( )
{
    new 
iTime30 ];
    
get_time"%I:%M %p"iTimecharsmaxiTime ) );
    
    if( 
strcmpiTimegSpecifiedTime ) == )
    {
        return 
1;
    }
    
    else
    {
        return 
0;
    }
    
    return 
0;

__________________

Last edited by tuty; 09-20-2011 at 08:51.
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
 



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 19:40.


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