AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Timer (https://forums.alliedmods.net/showthread.php?t=244229)

Alphad 07-15-2014 11:58

Timer
 
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***

mottzi 07-15-2014 12:32

Re: Timer
 
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)



Alphad 07-15-2014 12:40

Re: Timer
 
Quote:

Originally Posted by mottzi (Post 2168151)
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?

mottzi 07-15-2014 12:46

Re: Timer
 
call remove_task(1337) to remove the countdown task.

Black Rose 07-15-2014 12:57

Re: Timer
 
Or use the a flag and set a count.


All times are GMT -4. The time now is 21:18.

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