Raised This Month: $ Target: $400
 0% 

Timer


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Alphad
Senior Member
Join Date: Jun 2014
Old 07-15-2014 , 11:58   Timer
Reply With Quote #1

Could someone give me a example of a timer? in a hud message?
Or tell me how to do it? Thanks!
Edit: I mean a countdown***

Last edited by Alphad; 07-15-2014 at 11:59.
Alphad is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-15-2014 , 12:32   Re: Timer
Reply With Quote #2

use set_task() with the b flag

pseudo code:
PHP Code:
g_Counter 10
set_task
(1.0"count"1337__"b")

public 
count(id)
{
    
show_hudmessage(0"%i"g_Counter--)

    if(
g_Counter == 0)
        
remove_task(id)


Last edited by mottzi; 07-15-2014 at 12:33.
mottzi is offline
Send a message via MSN to mottzi
Alphad
Senior Member
Join Date: Jun 2014
Old 07-15-2014 , 12:40   Re: Timer
Reply With Quote #3

Quote:
Originally Posted by mottzi View Post
use set_task() with the b flag

pseudo code:
PHP Code:
g_Counter 10
set_task
(1.0"count"1337__"b")

public 
count(id)
{
    
show_hudmessage(0"%i"g_Counter--)

    if(
g_Counter == 0)
        
remove_task(id)

Thanks, and how can I stop a countdown if its in the middle?
Alphad is offline
mottzi
Veteran Member
Join Date: May 2010
Location: Switzerland
Old 07-15-2014 , 12:46   Re: Timer
Reply With Quote #4

call remove_task(1337) to remove the countdown task.
mottzi is offline
Send a message via MSN to mottzi
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 07-15-2014 , 12:57   Re: Timer
Reply With Quote #5

Or use the a flag and set a count.
__________________
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 21:18.


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