Raised This Month: $ Target: $400
 0% 

Timer Problem.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
tanayraj
Member
Join Date: Sep 2011
Location: India
Old 09-03-2013 , 11:07   Timer Problem.
Reply With Quote #1

Hey ! i was just trying to make a simple timer .In which when we type /lotto its starts a countdown to 0 from 5 mins and if we type /results it displays the type left for it to end.
I am a getting a problem. When the timer reaches "4 Minutes and 0 Secs" after that it displays time like "-1 , -60" and weird stuff.I want it to display "3 Minutes and 59 secs" and then continue to till "0 minutes and 0 secs"
Attached Files
File Type: sma Get Plugin or Get Source (jbed_lottotime.sma - 689 views - 1.6 KB)
tanayraj is offline
Send a message via Skype™ to tanayraj
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 09-03-2013 , 11:16   Re: Timer Problem.
Reply With Quote #2

you forgot to check if minutes and seconds are both zero. So task loop will continue permanently

Last edited by akcaliberg; 09-03-2013 at 11:17.
akcaliberg is offline
tanayraj
Member
Join Date: Sep 2011
Location: India
Old 09-03-2013 , 11:20   Re: Timer Problem.
Reply With Quote #3

Quote:
Originally Posted by akcaliberg View Post
you forgot to check if minutes and seconds are both zero. So task loop will continue permanently
I dont know how to please fix it.
Thanks. (PS - i am new too pawn)
tanayraj is offline
Send a message via Skype™ to tanayraj
akcaliberg
Senior Member
Join Date: Nov 2011
Location: Istanbul
Old 09-03-2013 , 11:41   Re: Timer Problem.
Reply With Quote #4

PHP Code:
public Counter(id)
{
    
id -= TaskID_Counter

    Results_TimeLeft_Secs
[id]--

    if (!
Results_TimeLeft_Secs[id])
    {
    
        if(!
Results_Timeleft_Mins[id]) return
        else 
Results_TimeLeft_Mins[id]--

    }

    
set_task(1.0"Counter"id TaskID_Counter)

akcaliberg is offline
tanayraj
Member
Join Date: Sep 2011
Location: India
Old 09-03-2013 , 15:34   Re: Timer Problem.
Reply With Quote #5

Not working.
__________________
__________________________________________
Add on steam -TaAaZZ28
Site -www.tanayr.com
tanayraj is offline
Send a message via Skype™ to tanayraj
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 09-03-2013 , 15:54   Re: Timer Problem.
Reply With Quote #6

Code:
public Counter(id) {     id -= TaskID_Counter         Results_TimeLeft_Secs[id]--         if ( ! Results_TimeLeft_Secs[id] && ! Results_TimeLeft_Mins[id] ) {         Lotto_Results(id);         return;     }         if ( Results_TimeLeft_Secs[id] == -1 ) {         Results_TimeLeft_Mins[id]--;         Results_TimeLeft_Secs[id] = 59;     }         set_task(1.0, "Counter", id + TaskID_Counter) }
__________________

Last edited by Black Rose; 09-03-2013 at 15:59.
Black Rose 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:04.


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