Raised This Month: $ Target: $400
 0% 

Doing something on specific date-time


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
reinert
Veteran Member
Join Date: Feb 2007
Old 09-20-2011 , 08:15   Doing something on specific date-time
Reply With Quote #1

Hey, how to grab the specific time like I want to do some action every day on 3:00 PM.
reinert is offline
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
Hunter-Digital
Veteran Member
Join Date: Aug 2006
Location: In the Game [ro]
Old 09-20-2011 , 23:34   Re: Doing something on specific date-time
Reply With Quote #3

I think it would be more efficient to just get time when the map starts and then calculate how many seconds are until the target time, then just set a task, if the map lasts until that time, it'll trigger, if not, the next map will set a new task and so on.
__________________
Hunter-Digital is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 09-21-2011 , 06:10   Re: Doing something on specific date-time
Reply With Quote #4

i just shown my type of idea, if you have a better one share it xD
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 09-21-2011 , 18:10   Re: Doing something on specific date-time
Reply With Quote #5

Quote:
Originally Posted by tuty View Post
if you have a better one share it xD
He just did!
__________________
fysiks is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 09-22-2011 , 06:35   Re: Doing something on specific date-time
Reply With Quote #6

lol i mean the code not theory
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 09-22-2011 , 07:44   Re: Doing something on specific date-time
Reply With Quote #7

Quote:
Originally Posted by tuty View Post
lol i mean the code not theory
He just gave you an example, this is scripting help so imo it would'nt even be nice of him if he just gave out the code.
Then that dude who asked for it doesn't even need to understand the code he could just come here and ask for everything he needs and copy paste until he have a full plugin.

That stuff I think should rather be in requests section.
Erox902 is offline
tuty
Veteran Member
Join Date: Jul 2008
Location: UK
Old 09-22-2011 , 14:13   Re: Doing something on specific date-time
Reply With Quote #8

are you fucking retarded? i know how to do it and i dont want this fricking code...i didnt requested this just read my fucking posts. if my code can help you i'm glad, if not gtfo :/ im too lazy to create his code for someone who need this...
__________________
tuty is offline
Send a message via ICQ to tuty Send a message via AIM to tuty
Erox902
Veteran Member
Join Date: Jun 2009
Location: Never Never Land
Old 09-22-2011 , 14:19   Re: Doing something on specific date-time
Reply With Quote #9

Quote:
Originally Posted by tuty View Post
are you fucking retarded? i know how to do it and i dont want this fricking code...i didnt requested this just read my fucking posts. if my code can help you i'm glad, if not gtfo :/ im too lazy to create his code for someone who need this...
Yeah exactly!
I did'nt want you to post a code!
Read your own post again and then mine and try to understand.
You told him to post his code not just explain how he does it.
I'm saying he should not!
Erox902 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 09-22-2011 , 14:37   Re: Doing something on specific date-time
Reply With Quote #10

Quote:
Originally Posted by tuty View Post
are you fucking retarded? i know how to do it and i dont want this fricking code...i didnt requested this just read my fucking posts. if my code can help you i'm glad, if not gtfo :/ im too lazy to create his code for someone who need this...
Hunter-Digital's way (even if not displayed in a code) is obviously better than yours. Instead of saying "use whatever you like" you should advise the guy to use the better way, and instead of requesting the guy with better idea to create a code, do it yourself if you feel like it's needed (and as it turns out, it's not). Unless, of couse, you don't realize which way is better, in which case you probably shouldn't be helping people at all, since in this case it's pretty obvious.

Not trying to sound rude here, but if you intend to help, then help.
__________________

Last edited by hleV; 09-22-2011 at 14:41.
hleV is offline
Reply



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:35.


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