Go4Expert

Go4Expert (http://www.go4expert.com/)
-   C (http://www.go4expert.com/forums/c/)
-   -   Need a "timer" program that counts down.... (http://www.go4expert.com/forums/timer-program-counts-t813/)

Mayh3m 20May2006 06:05

Need a "timer" program that counts down....
 
Hi, first of all let me say that Im an idiot and I know nothing about programming anything more than the most rudimentary HTML.

However, it seems logical that the program I have in mind wouldnt be longer than 10 lines of code max. The problem is I dont know what those 10 lines of code are or how I would go about compiling them...

What Im looking to do is create a "spawn timer" for Battlefield 2 MC that would alert me with an auditory alarm every 14 seconds.

The reason behind this is that there is an ongoing "spawn timer" on BF2 servers. Every 14 seconds, whoever is dead will be allowed to respawn. The counter starts as soon as the game starts and cylces over and over until the end of the game.

Thus, if I simply synchronise my program timer with the servers, I should be able to "hear" when people are going to be spawning in around me and be ready for them.

The specifics: A program that has a start button, a visible 14 second cyclical countdown timer which plays "spawnimminent.wav" on 02.00 seconds and then resets after reaching 00.00 seconds.

Im not sure if you guys take program requests or not, but this seems like such an easy thing that it would take you geniuses about 14 seconds to create it =P. Also, I'm willing to tip whoever does this 5 bucks or so via paypal.

Thanks!

Aztec 20May2006 23:48

Re: Need a "timer" program that counts down....
 
This might give you a hint
Code:

#include<ctime>
#include<iostream>

int main()
{

        time_t t1=time(0);
        time_t t2=time(0);
        while(difftime(t2,t1)!=14)
                {
                        std::cout<<"hello";
                        t2=time(0);
                }
        return 0;
}


Mayh3m 21May2006 05:30

Re: Need a "timer" program that counts down....
 
Ah, Thanks! I have no idea what program to use to compile that, but its a damn good start.
Thanks for taking the time to respond!

Aztec 21May2006 08:03

Re: Need a "timer" program that counts down....
 
Quote:

Originally Posted by Mayh3m
I have no idea what program to use to compile that, but its a damn good start.

It's a C++ code. So, it's pretty obvious you need a C++ compiler. You can download DEV C++.


All times are GMT +5.5. The time now is 12:34.