[Tutorial]How to set the Time in the HUDDisplay

Results 1 to 8 of 8
  1. #1
    ☆Dying Dawn☆ Bombillo is offline
    MemberRank
    Jan 2012 Join Date
    ValhallaLocation
    977Posts

    note [Tutorial]How to set the Time in the HUDDisplay

    This is very simple and many ppl was looking for this to get the time in the huddisplay like the Warz alpha (me for ex)

    For a better visualization look my video tutorial Minute: 3:43 about add the basic sprite design on screen

    first of all let's look for this, and uncomment it
    Code:
    //hudMain->setTime(CGL.GetServerGameTime());
    or If you don't have the function so after this, add the code above
    Code:
    hudMain->setThreatValue(GetGraduatedZombieThreat());


    Now in the HUDDisplay let's search for this
    Code:
    void HUDDisplay::setThreatValue(int percent)
    and below or above add this entery function
    Code:
    void HUDDisplay::setTime(__int64 utcTime) // time in displayhud
    {
        const static char* months[12] = {
            "January",
            "February",
            "March",
            "April",
            "May",
            "June",
            "July",
            "August",
            "September",
            "October",
            "November",
            "December"
        };
        struct tm* tm = _gmtime64(&utcTime);
    
        char date[128];
        char time[128];
        sprintf(date, "%s %d, %d", gLangMngr.getString(months[tm->tm_mon]), tm->tm_mday, 1900 + tm->tm_year);
        sprintf(time, "%02d:%02d", tm->tm_hour, tm->tm_min);
    
        Scaleform::GFx::Value var[2];
        var[0].SetString(date);
        var[1].SetString(time);
        gfxHUD.Invoke("_root.api.setTime", var, 2);
    }
    now in HUDDisplay let's declarate the void

    after this
    Code:
    void    setThreatValue(int percent);
    add this
    Code:
    void    setTime(__int64 utcTime); // time in displayhud
    ActionScript little code
    into your flash file address(src\classes\warz\hud)

    open HUD.as

    and search for
    Code:
    public function setChatVisibility(show:Boolean)
    add below that
    Code:
    public    function setTime (date:String, time:String):void
            {
                Main.Time.Date.text = date;
                Main.Time.DateShad.text = date;
                Main.Time.Time.text = time;
                Main.Time.TimeShad.text = time;
            }
    Code:
    ENJOY THE MINI FRUIT CAKE


  2. #2
    Account Upgraded | Title Enabled! djbadboys38 is offline
    MemberRank
    Aug 2010 Join Date
    TanzanyaLocation
    1,365Posts

    Re: [Tutorial]How to set the Time in the HUDDisplay

    Nice mate thanks for tutorial ^^

  3. #3
    Valued Member francovegini is offline
    MemberRank
    Apr 2014 Join Date
    BrazilLocation
    135Posts

    Re: [Tutorial]How to set the Time in the HUDDisplay

    good work guy

  4. #4
    Account Upgraded | Title Enabled! Adnan DatLife is offline
    MemberRank
    Aug 2015 Join Date
    main.cppLocation
    207Posts

    Re: [Tutorial]How to set the Time in the HUDDisplay

    Good Job.

  5. #5
    My Status --> LukasCCB is offline
    MemberRank
    Apr 2013 Join Date
    CracolandiaLocation
    1,190Posts

    Re: [Tutorial]How to set the Time in the HUDDisplay

    Much good, thanks bro.

  6. #6
    Play Alpha MMO DouglasPro is offline
    MemberRank
    Nov 2014 Join Date
    //HKEY//RJ_BRLocation
    392Posts

    Re: [Tutorial]How to set the Time in the HUDDisplay

    Good job bro

  7. #7
    Valued Member balazs12 is offline
    MemberRank
    Dec 2014 Join Date
    128Posts

    Re: [Tutorial]How to set the Time in the HUDDisplay

    Nice job dude.

  8. #8
    My Status --> LukasCCB is offline
    MemberRank
    Apr 2013 Join Date
    CracolandiaLocation
    1,190Posts

    Re: [Tutorial]How to set the Time in the HUDDisplay

    Style DayZ, press button key for show/hide

    Is easy to add this button to control in options, follow DouglasPro tutorial F7 friend.

    In
    Code:
    hudMain->setTime(CGL.GetServerGameTime());
    Change to

    Code:
    if(Keyboard->IsPressed(kbsH)){
                    hudMain->setTime(CGL.GetServerGameTime());
    
    
                    if(hudPause->isActive())
                    hudPause->setTime(CGL.GetServerGameTime());
                }
    Flash
    Code:
    public function setTime (date:String, time:String):void
    Add
    Code:
    Main.Time.visible = false;
    I do not know if it works, can make a mistake, I have not tested.
    Last edited by LukasCCB; 27-10-16 at 10:28 PM.



Advertisement