.:: Bots United ::.

.:: Bots United ::. (http://forums.bots-united.com/index.php)
-   General Bot Coding (http://forums.bots-united.com/forumdisplay.php?f=24)
-   -   CS time... special? (http://forums.bots-united.com/showthread.php?t=313)

Fierce Recon 11-01-2004 00:17

CS time... special?
 
Is there anything special about gpGlobals->time in cs, because in a lot of plugins, i saw that they somehow used timelimit and timeleft...

If there's a difference could someone explain it to me?

Pierre-Marie Baty 11-01-2004 00:40

Re: CS time... special?
 
AFAIK, "timelimit" and "timeleft" don't exist in the Half-Life globalvars_t structure. These are variables that are computed out of gpGlobals->time. Let's say timelimit is the date at which the round will end, and timeleft is what it says.

Code:

// on round start
timelimit = gpGlobals->time + CVAR_GET_FLOAT ("mp_thecvarthatholdstheroundduration");
 
// anytime
timeleft = timelimit - gpGlobals->time;


Fierce Recon 11-01-2004 05:35

Re: CS time... special?
 
so otherwise there's no change to gpGlobals->time that's done by mp.dll?

when i say timelimit and timeleft, i mean that they use cs cvars...

I noticed this in the amx, where OLO uses those 2 for timers, so I got a little confused, why not do
Code:

...
float last_ticked;
...
struct timer {
...
float waitleft;
float wait;
...
}
...
void timertick()
{
...
if (timer->waitleft - (gpGlobals->time - last_ticked) <= 0)
...
last_ticked = gpGlobals->time;
}

Instead of what he does (which just plainly scares me)

Pierre-Marie Baty 12-01-2004 02:12

Re: CS time... special?
 
What's the difference ? ???:(

gpGlobals->time is always different each frame, and it can't be "paused". I'm not sure I understand what you are doing here...

Cheeseh 13-01-2004 18:16

Re: CS time... special?
 
mp_timelimit is in minutes by the way, and gpGlobals->time is in seconds, so you need to multiply mp_timelimit value by 60 first before comparing it with gpGlobals->time

:D

BAStumm 13-01-2004 21:03

Re: CS time... special?
 
not all mods support mp_timelimit. DoD does not where TFC does. I do not know about other mods.

Your better off with timeleft = mp_timelimit - gpGlobals->time


All times are GMT +2. The time now is 16:50.

Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.