Or you can always use the CountDownTimer class in the util_shared.h...

CountDownTimer roundTimer;
roundTimer.Start(mp_roundlimit.GetFloat() * 60);

if (roundTimer.isElapsed())
{
....
}

roundTimer.Reset()...

and so on.. Just look the CountDownTimer class.


On Mon, 21 Feb 2005 17:04:09 +0000, Ben Davison
<[EMAIL PROTECTED]> wrote:
> I'll show you my basic timer(you have to add the hud elements yourself)
>
> This for HL2DM.
>
> multiplay_gamerules.h
> extern ConVar mp_roundlimit;
>
> multiplay_gamerules.cpp
> // Round limit
> ConVar  mp_roundlimit( "mp_roundlimit",
>                                          "0",
>                                          FCVAR_NOTIFY|FCVAR_REPLICATED,
>                                          "game time per round in minutes" );
>
> hl2mp_gamerules.cpp
>
> void CHL2MPRules::Think( void ) In this function.
>
>          float flRoundTimer = mp_roundlimit.GetFloat() * 60;
>
>         //Intrest: Timer.
>         if ( flRoundTimer != 0 && gpGlobals->curtime >= flRoundTimer )
>         {
>                 Msg("Round over");
>                 return;
>                 //RestartRound();
>         }
>
> As you can see you will have to put it on the hud and RestartRound();
> On Thu, 01 Jan 2004 00:13:54 +0000, Knifa <[EMAIL PROTECTED]> wrote:
> > Okay, thanks alot :)
> >
> > >http://www.sourcewiki.org/wiki/index.php/Creating_a_Roundtimer
> > >
> > >that shows you how to make a round timer and display it on the HUD.
> > >basically all you do is put a timer in either your game rules(for a
> > >global timer) or your player(for a timer for each player) by checking
> > >a start time against gpGlobals->curtime and getting a hud element to
> > >display it, or in your case call something to trigger a build event
> > >and restart. the tute decribes it better :(
> > >
> > >
> > >--
> > >**********************
> > >Draco
> > >Coder for Perfect Dark and Kreedz Climbing
> > >http://perfectdark.game-mod.net
> > >
> > >_______________________________________________
> > >To unsubscribe, edit your list preferences, or view the list archives, 
> > >please visit:
> > >http://list.valvesoftware.com/mailman/listinfo/hlcoders
> > >
> > >
> > >
> > >
> > >
> > >
> >
> > --
> > Knifa
> > Domino Mod
> > http://knd.org.uk/dominomod/
> >
> > _______________________________________________
> > To unsubscribe, edit your list preferences, or view the list archives, 
> > please visit:
> > http://list.valvesoftware.com/mailman/listinfo/hlcoders
> >
> >
>
> --
> - Ben Davison
> - http://www.shadow-phoenix.com
>
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please 
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>

_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please 
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders

Reply via email to