Forum

Backwards running clock?

Discuss programming in the QuakeC language.

Moderator: InsideQC Admins

Backwards running clock?

Postby Baker » Fri Jun 11, 2010 2:50 am

CRMOD and a few other deathmatch mods run the clock backwards.

For instance, at the beginning of a match the clock might show 20:00 and runs down to 0.

How is it possible to have the time on a server be reversed?
The night is young. How else can I annoy the world before sunsrise? 8) Inquisitive minds want to know ! And if they don't -- well like that ever has stopped me before ..
User avatar
Baker
 
Posts: 3666
Joined: Tue Mar 14, 2006 5:15 am

Postby Urre » Fri Jun 11, 2010 11:24 am

The time isn't reversed. They have a separate timer, which starts with a value, and gets decreased each frame with frametime, or perhaps a think function every second which subtracts a second from it.

Don't mess with the server time :P
I was once a Quake modder
User avatar
Urre
 
Posts: 1109
Joined: Fri Nov 05, 2004 2:36 am
Location: Moon

Postby frag.machine » Fri Jun 11, 2010 12:19 pm

Or maybe a simple arithmetic: sv_timelimit - current time ?
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby ceriux » Fri Jun 11, 2010 5:18 pm

float gtime;

if (time == time +1);
{
gtime = gtime -1;
};

i havnt messed with .qc in a while but i think it would be something similar to this?
User avatar
ceriux
 
Posts: 2223
Joined: Sat Sep 06, 2008 3:30 pm
Location: Indiana, USA

Postby metlslime » Fri Jun 11, 2010 5:36 pm

ceriux wrote:if (time == time +1);

:D
metlslime
 
Posts: 316
Joined: Tue Feb 05, 2008 11:03 pm

Postby frag.machine » Fri Jun 11, 2010 6:53 pm

metlslime wrote:
ceriux wrote:if (time == time +1);

:D


Damn I LOL'd so loud my boss just stared at me :lol:
I know FrikaC made a cgi-bin version of the quakec interpreter once and wrote part of his website in QuakeC :) (LordHavoc)
User avatar
frag.machine
 
Posts: 2090
Joined: Sat Nov 25, 2006 1:49 pm

Postby r00k » Sat Jun 12, 2010 7:50 am

Code: Select all
void (entity e, float m, float s) pqc_match_time =
{   
   local float msg_type;

   if (e == world)
      msg_type = MSG_ALL;
   else
   {
      msg_entity = e;
      msg_type = MSG_ONE;
   }

   WriteByte (msg_type, SVC_STUFFCMD);
   WriteByte (msg_type, 1);
   WriteByte (msg_type, PQC_MATCH_TIME);
   WriteBytePQ (msg_type, m);
   WriteBytePQ (msg_type, s);
   WriteString (msg_type, string_null);
};


this is what the quakeC side of pq_timer 1 looks like.
r00k
 
Posts: 1110
Joined: Sat Nov 13, 2004 10:39 pm


Return to QuakeC Programming

Who is online

Users browsing this forum: No registered users and 1 guest