Raised This Month: $ Target: $400
 0% 

CountDown...


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
kramesa
Veteran Member
Join Date: Feb 2011
Location: Brazil
Old 05-04-2012 , 21:57   Re: CountDown...
Reply With Quote #5

Quote:
Originally Posted by ConnorMcLeod View Post
Usage example for a 15 seconds countdown :

MakeCountDown(15.0)

PHP Code:
#include <engine>
#include <fakemeta>

new g_entCountDownFloat:g_flFreqFloat:g_flTimeleft

MakeCountDown
Float;flTimeleft Float:flFrequency 1.0 )
{
    if( !
g_entCountDown )
    {
        
g_entCountDown create_entity("info_target")
        new const 
szClass[] = "countdown"
        
register_think(szClass"CountDown")
        
set_pev(g_entCountDownpev_classnameszClass)
    }
    
g_flTimeLeft flTimeleft
    g_flFreq 
flFrequency
    set_pev
(g_entCountDownpev_nextthinkget_gametime())
    
call_think(g_entCountDown)
}

public 
CountDowniEntity )
{
    if( 
iEntity != g_entCountDown )
    {
        return
    }

    
// Do stuff here

    // client_print(0, print_center, "Time Left Before Awesome Thing is %.0f sec", g_flTimeleft)
    

    // end of stuff, update timers
    
set_pev(g_entCountDownpev_nextthinkget_gametime() - g_flFreq)
    
g_flTimeleft -= g_flFreq

Ok, thank you.
__________________

Last edited by kramesa; 05-04-2012 at 21:58.
kramesa is offline
 



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 00:23.


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