 |
|
Veteran Member
Join Date: Feb 2011
Location: Brazil
|

05-04-2012
, 21:57
Re: CountDown...
|
#5
|
Quote:
Originally Posted by ConnorMcLeod
Usage example for a 15 seconds countdown :
MakeCountDown(15.0)
PHP Code:
#include <engine> #include <fakemeta>
new g_entCountDown, Float:g_flFreq, Float: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_entCountDown, pev_classname, szClass) } g_flTimeLeft = flTimeleft g_flFreq = flFrequency set_pev(g_entCountDown, pev_nextthink, get_gametime()) call_think(g_entCountDown) }
public CountDown( iEntity ) { 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_entCountDown, pev_nextthink, get_gametime() - g_flFreq) g_flTimeleft -= g_flFreq }
|
Ok, thank you.
__________________
Last edited by kramesa; 05-04-2012 at 21:58.
|
|
|
|