Raised This Month: $ Target: $400
 0% 

Event for specified time - do every day in xx:xx hours


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Hepaa
Junior Member
Join Date: Apr 2011
Old 10-06-2014 , 14:04   Event for specified time - do every day in xx:xx hours
Reply With Quote #1

Hi, do you know if is possible to have event that will run every day in xx : xx time? E.g. in 19:00 every day. Thank you.

Last edited by Hepaa; 10-06-2014 at 14:04.
Hepaa is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 10-06-2014 , 14:31   Re: Event for specified time - do every day in xx:xx hours
Reply With Quote #2

I have this, bit it's need to fix errors.
PHP Code:
stock set_task_runtime(time[11], const func[], id 0, const param[]=""len 0)
{
 
new 
h[5], m[5], s[5]
 
get_time("%H"hcharsmax(h))
get_time("%M"mcharsmax(m))
get_time("%S"scharsmax(s))
 
new 
iCurSeconds = (str_to_num(h) * 3600) + (str_to_num(m) * 60) + str_to_num(s)
 
replace_all(timecharsmax(time), ":" " ")
parse(timehcharsmax(h), mcharsmax(m), scharsmax(s))
 
new 
iRunSeconds = (str_to_num(h) * 3600)+ (str_to_num(m) * 60) + str_to_num(s)
 
new 
iTotal iRunSeconds iCurSeconds
 
if(iTotal<=0iTotal iCurSeconds iRunSeconds
 
return set_task(float(iTotal), funcidparamlen)
 

PHP Code:
set_task_runtime("23:00:00""GoToSleep_Kid"id
If anyone is can fix it, please.
FromTheFuture is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 10-06-2014 , 14:55   Re: Event for specified time - do every day in xx:xx hours
Reply With Quote #3

I fix it =D
Wait...
FromTheFuture is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 10-06-2014 , 15:02   Re: Event for specified time - do every day in xx:xx hours
Reply With Quote #4

PHP Code:
stock set_task_runtime(str_time[11], const func[], id 0, const param[] = ""len 0
{
    new 
h[5], m[5], s[5]; 

    
get_time("%H"hcharsmax(h)); 
    
get_time("%M"mcharsmax(m)); 
    
get_time("%S"scharsmax(s)); 
  
    new 
iCurSeconds = (str_to_num(h) * 3600) + (str_to_num(m) * 60) + str_to_num(s); 
  
    
replace_all(str_timecharsmax(str_time), ":" " "); 
    
parse(str_timehcharsmax(h), mcharsmax(m), scharsmax(s)); 
  
    new 
iRunSeconds = (str_to_num(h) * 3600)+ (str_to_num(m) * 60) + str_to_num(s);
  
    new 
iTotal iRunSeconds iCurSeconds;
  
    if(
iTotal <= 0
    {
        
iTotal = ( 86400 iCurSeconds ) + iRunSeconds;
    }
  
    return 
set_task(float(iTotal), funcidparamlen); 

FromTheFuture is offline
Hepaa
Junior Member
Join Date: Apr 2011
Old 10-06-2014 , 15:11   Re: Event for specified time - do every day in xx:xx hours
Reply With Quote #5

Thank you, i will try that. Where can I specify time what I need? And where can I set action to do when the time come?
Hepaa is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 10-06-2014 , 15:15   Re: Event for specified time - do every day in xx:xx hours
Reply With Quote #6

Quote:
Originally Posted by Hepaa View Post
Thank you, i will try that. Where can I specify time what I need? And where can I set action to do when the time come?
U must set this in
PHP Code:
set_task_runtime("01:02:00""YourFunction"id
and after all code paste the stock.
FromTheFuture is offline
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 10-06-2014 , 21:02   Re: Event for specified time - do every day in xx:xx hours
Reply With Quote #7

Simply use "Task Scheduler" plugin.

@FromTheFuture, you can't set a task that is longer than mp_timelimit.
__________________

Last edited by fysiks; 10-06-2014 at 21:04.
fysiks is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 10-07-2014 , 04:34  
Reply With Quote #8

Quote:
Originally Posted by fysiks View Post
@FromTheFuture, you can't set a task that is longer than mp_timelimit.
Great, no need to make a check in the stock.

Quote:
Originally Posted by fysiks View Post
Simply use "Task Scheduler" plugin.
I think this stock will be better to use.

Last edited by YamiKaitou; 10-07-2014 at 08:07.
FromTheFuture is offline
aron9forever
Veteran Member
Join Date: Feb 2013
Location: Rromania
Old 10-07-2014 , 07:32   Re: Event for specified time - do every day in xx:xx hours
Reply With Quote #9

PHP Code:

    
new CurrentTime[9
    
get_time("%H",CurrentTime,8)
    new 
hour str_to_num(CurrentTime)
    if(
hour==19)
{
//event

__________________
Meanwhile, in 2050:
Quote:
Originally Posted by aron9forever
useless small optimizations
Quote:
Originally Posted by Black Rose View Post
On a map that is 512x512x128 units you end up with 3,355,443,200,000 different "positions". To store each one of those positions individually in the variable "user_or" you need 12 terabytes of memory.
aron9forever is offline
FromTheFuture
Senior Member
Join Date: Jan 2013
Old 10-07-2014 , 08:16   Re: Event for specified time - do every day in xx:xx hours
Reply With Quote #10

Quote:
Originally Posted by aron9forever View Post
PHP Code:

    
new CurrentTime[9
    
get_time("%H",CurrentTime,8)
    new 
hour str_to_num(CurrentTime)
    if(
hour==19)
{
//event

No. And u can get hour with
PHP Code:
new htime(h); 
FromTheFuture 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 17:36.


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