Need a "timer" program that counts down....

Discussion in 'C' started by Mayh3m, May 20, 2006.

  1. Mayh3m

    Mayh3m New Member

    Joined:
    May 20, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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!
     
  2. Aztec

    Aztec New Member

    Joined:
    May 9, 2006
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    0
    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;
    }
     
  3. Mayh3m

    Mayh3m New Member

    Joined:
    May 20, 2006
    Messages:
    2
    Likes Received:
    0
    Trophy Points:
    0
    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!
     
  4. Aztec

    Aztec New Member

    Joined:
    May 9, 2006
    Messages:
    90
    Likes Received:
    0
    Trophy Points:
    0
    It's a C++ code. So, it's pretty obvious you need a C++ compiler. You can download DEV C++.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice