Page 2 of 2 FirstFirst 12
Results 11 to 20 of 20

Thread: Time played

  1. #11
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts
    If you want time in seconds hud wont be difficult.

    Call this function on playerConnected: ( self thread _countTime() )

    and on CallbackStartGametype add:

    precacheString(&"Seconds Played: ");

    PHP Code:
    _countTime()
    {
        
    self endon("disconnect");

        
    self.seconds_HUD newClientHudElem(self);    
        
    self.seconds_HUD.305;
        
    self.seconds_HUD.140;
        
    self.seconds_HUD.alignX "center";
        
    self.seconds_HUD.alignY "middle";
        
    self.seconds_HUD.sort 1;
        
    self.seconds_HUD.alpha 1;
        
    self.seconds_HUD.fontScale 1.3;
        
    self.seconds_HUD.label = &"Seconds Played: ";

        
    self.timeplayed 0;
        
        while(
    1)
        {
            
    wait 1;
            
    self.timeplayed+= 1;
            
    self.seconds_HUD setValue(self.timeplayed);
        }
        

    I hope, I helped you a bit.

  2. The Following User Says Thank You to RobsoN For This Useful Post:

    Ni3ls (12th June 2013)

  3. #12
    Private First Class thOuMta's Avatar
    Join Date
    Oct 2012
    Location
    France
    Posts
    191
    Thanks
    139
    Thanked 35 Times in 28 Posts
    Thx rob

    What i need make for count this time in min ? like 0:00.

  4. #13
    Private First Class RobsoN's Avatar
    Join Date
    Jan 2013
    Location
    /home/cod2/
    Posts
    230
    Thanks
    119
    Thanked 95 Times in 64 Posts
    You need 2 Huds. Just add 1 more hud call it eg. minutes_HUD, then in while(1) loop add: self.minutesplayed += 1/60; and self.minutes_HUD setValue(int(self.minutesplayed));

    ah + define the varriable below self.timeplayed = 0; add: self.minutesplayed = 0;

  5. The Following User Says Thank You to RobsoN For This Useful Post:

    thOuMta (12th June 2013)

  6. #14
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    113
    Thanks
    10
    Thanked 74 Times in 45 Posts

  7. #15
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Please read the thread before posting. IznoGod has already pointed out that the setTimerUp() does not work in COD2 MP (although it does in SP).

  8. The Following 2 Users Say Thank You to Tally For This Useful Post:

    kung foo man (12th June 2013),thOuMta (12th June 2013)

  9. #16
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    Well, settimerup does NOT return an error when using it. It just doesnt start counting.

    Note: this was tested on a linux server.

  10. #17
    Brigadier General
    Join Date
    Oct 2012
    Posts
    994
    Thanks
    20
    Thanked 588 Times in 388 Posts
    Quote Originally Posted by IzNoGoD View Post
    Well, settimerup does NOT return an error when using it. It just doesnt start counting.

    Note: this was tested on a linux server.
    No one said it DOES.

  11. #18
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    What i mean to say is, normally, when trying SP-only functions in MP, you get the "unknown function"-error.
    Not with settimerup.

    As this is different from all those SP-functions, I pointed it out for the sake of the community. It just might work on windows servers for example.

  12. The Following User Says Thank You to IzNoGoD For This Useful Post:

    kung foo man (12th June 2013)

  13. #19
    Private
    Join Date
    May 2013
    Posts
    27
    Thanks
    0
    Thanked 19 Times in 11 Posts
    It's kinda counter-intuitive, but the time you pass as parameter for setTimerUp and setTenthsTimerUp is the time to wait before it starts ticking. There is no way to set the max, so it just ticks until you kill the hud element. Do a quick test using setTimerUp(10), and you will see it will start ticking after 10 seconds.

  14. The Following 3 Users Say Thank You to PatmanSan For This Useful Post:

    kung foo man (12th June 2013),Ni3ls (13th June 2013),randall (12th June 2013)

  15. #20
    Private
    Join Date
    Jan 2013
    Location
    Hungary
    Posts
    113
    Thanks
    10
    Thanked 74 Times in 45 Posts
    Quote Originally Posted by Tally View Post
    Please read the thread before posting. IznoGod has already pointed out that the setTimerUp() does not work in COD2 MP (although it does in SP).
    Yes, but IzNoGod's pointing was wrong such as the function description in Docs. The time argument in fact a delay in seconds.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •