Results 1 to 6 of 6

Thread: Help With my HUD (Stamina doest not working)

  1. #1
    iBot User
    Join Date
    May 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    3 Post(s)
    Reputation
    10
    Rep Power
    4

    Help With my HUD (Stamina doest not working)

    I'm doing my own HUD and am having problems to configure the function to show stamina in hours.
    Below is the way I put it :

    addtext(' [ HUD by MELAO83 ]', 15, y)
    y = y + 7
    setfontcolor("white")
    addtext('--------------------------------------------', 0, y)
    setfontcolor("yellow")
    y = y + 7
    addtext(' [ Bootting stats ]', 15, y)
    y = y + 7
    setfontcolor("white")
    addtext('--------------------------------------------', 0, y)
    setfontcolor("orange")
    y = y + 5
    addtext('Current Level', x, y)
    addtext(': ' ..level, 120, y)
    y = y + 10
    addtext('Exp Per Hour', x, y)
    addtext('- ' .. exphour, 120, y)
    y = y + 10
    addtext('Exp Left', x, y)
    addtext('- ' .. exptolevel(), 120, y)
    y = y + 10
    addtext('Exp Gained', x, y)
    addtext('- ' .. expgained, 120, y)
    y = y + 10
    addtext('Time Played', x, y)
    addtext('- ' .. timehunt, 120, y)
    y = y + 10
    addtext('Time to Next Level', x, y)
    addtext(': ' ..timetolevel, 120, y)
    y = y + 10
    addtext('Stamina', x, y)
    addtext(': ' ..stamina, 120, y)

    y = y + 10


    I tried several ways ( stamValue ), (transformstaminatorealtime(stamina)), but does not work.

    HELP!
    Last edited by Eli; 10-05-2014 at 01:21 PM.

  2. #2
    iBot User
    Join Date
    May 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    3 Post(s)
    Reputation
    10
    Rep Power
    4
    someone?!?

  3. #3
    iScripter Eli's Avatar
    Join Date
    Mar 2012
    Posts
    3,764
    Mentioned
    492 Post(s)
    Tagged
    2 Thread(s)
    Quoted
    956 Post(s)
    Reputation
    586
    Rep Power
    10
    Quote Originally Posted by marcel83 View Post
    I'm doing my own HUD and am having problems to configure the function to show stamina in hours.
    Below is the way I put it :

    addtext(' [ HUD by MELAO83 ]', 15, y)
    y = y + 7
    setfontcolor("white")
    addtext('--------------------------------------------', 0, y)
    setfontcolor("yellow")
    y = y + 7
    addtext(' [ Bootting stats ]', 15, y)
    y = y + 7
    setfontcolor("white")
    addtext('--------------------------------------------', 0, y)
    setfontcolor("orange")
    y = y + 5
    addtext('Current Level', x, y)
    addtext(': ' ..level, 120, y)
    y = y + 10
    addtext('Exp Per Hour', x, y)
    addtext('- ' .. exphour, 120, y)
    y = y + 10
    addtext('Exp Left', x, y)
    addtext('- ' .. exptolevel(), 120, y)
    y = y + 10
    addtext('Exp Gained', x, y)
    addtext('- ' .. expgained, 120, y)
    y = y + 10
    addtext('Time Played', x, y)
    addtext('- ' .. timehunt, 120, y)
    y = y + 10
    addtext('Time to Next Level', x, y)
    addtext(': ' ..timetolevel, 120, y)
    y = y + 10
    addtext('Stamina', x, y)
    addtext(': ' ..stamina, 120, y)

    y = y + 10


    I tried several ways ( stamValue ), (transformstaminatorealtime(stamina)), but does not work.

    HELP!
    What about local variables for HUD position? You forget them.

    Lua Code:
     
    local x = 10
    local y = 30
     
    addtext(' [ HUD by MELAO83 ]', 15, y)
    y = y + 7
    setfontcolor("white")
    addtext('--------------------------------------------', 0, y)
    setfontcolor("yellow")
    y = y + 7
    addtext(' [ Bootting stats ]', 15, y)
    y = y + 7
    setfontcolor("white")
    addtext('--------------------------------------------', 0, y)
    setfontcolor("orange")
    y = y + 5
    addtext('Current Level', x, y)
    addtext(': ' ..level, 120, y)
    y = y + 10
    addtext('Exp Per Hour', x, y)
    addtext('- ' .. exphour, 120, y)
    y = y + 10
    addtext('Exp Left', x, y)
    addtext('- ' .. exptolevel(), 120, y)
    y = y + 10
    addtext('Exp Gained', x, y)
    addtext('- ' .. expgained, 120, y)
    y = y + 10
    addtext('Time Played', x, y)
    addtext('- ' .. timehunt, 120, y)
    y = y + 10
    addtext('Time to Next Level', x, y)
    addtext(': ' ..timetolevel, 120, y)
    y = y + 10
    addtext('Stamina', x, y)
    addtext(': ' ..stamina, 120, y)
    y = y + 10


    Didn't tried but it must work, good luck!

  4. #4
    Moderator Drakke's Avatar
    Join Date
    Jun 2012
    Location
    Sweden
    Posts
    1,898
    Mentioned
    216 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    390 Post(s)
    Reputation
    366
    Rep Power
    10
    Quote Originally Posted by marcel83 View Post
    I'm doing my own HUD and am having problems to configure the function to show stamina in hours.
    Below is the way I put it :

    addtext(' [ HUD by MELAO83 ]', 15, y)
    y = y + 7
    setfontcolor("white")
    addtext('--------------------------------------------', 0, y)
    setfontcolor("yellow")
    y = y + 7
    addtext(' [ Bootting stats ]', 15, y)
    y = y + 7
    setfontcolor("white")
    addtext('--------------------------------------------', 0, y)
    setfontcolor("orange")
    y = y + 5
    addtext('Current Level', x, y)
    addtext(': ' ..level, 120, y)
    y = y + 10
    addtext('Exp Per Hour', x, y)
    addtext('- ' .. exphour, 120, y)
    y = y + 10
    addtext('Exp Left', x, y)
    addtext('- ' .. exptolevel(), 120, y)
    y = y + 10
    addtext('Exp Gained', x, y)
    addtext('- ' .. expgained, 120, y)
    y = y + 10
    addtext('Time Played', x, y)
    addtext('- ' .. timehunt, 120, y)
    y = y + 10
    addtext('Time to Next Level', x, y)
    addtext(': ' ..timetolevel, 120, y)
    y = y + 10
    addtext('Stamina', x, y)
    addtext(': ' ..stamina, 120, y)

    y = y + 10


    I tried several ways ( stamValue ), (transformstaminatorealtime(stamina)), but does not work.

    HELP!
    Should be
    string.format("%.2d:%.2d", stamina / 60, stamina % 60)

    Lua Code:
     
    addtext('      [ HUD by MELAO83 ]', 15, y)
       y = y + 7
       setfontcolor("white")
       addtext('--------------------------------------------', 0, y)
       setfontcolor("yellow")
       y = y + 7
       addtext('         [ Bootting stats ]', 15, y)
       y = y + 7
       setfontcolor("white")
       addtext('--------------------------------------------', 0, y)
       setfontcolor("orange")
       y = y + 5
       addtext('Current Level', x, y)
       addtext(': ' ..level, 120, y)
       y = y + 10
       addtext('Exp Per Hour', x, y)
       addtext('- ' .. exphour, 120, y)
       y = y + 10
       addtext('Exp Left', x, y)
       addtext('- ' .. exptolevel(), 120, y)
       y = y + 10
       addtext('Exp Gained', x, y)
       addtext('- ' .. expgained, 120, y)
       y = y + 10
       addtext('Time Played', x, y)
       addtext('- ' .. timehunt, 120, y)
       y = y + 10
       addtext('Time to Next Level', x, y)
       addtext(': ' ..timetolevel, 120, y)
       y = y + 10
       addtext('Stamina', x, y)
       addtext(string.format("%.2d:%.2d", stamina / 60, stamina % 60) .. 'h', 120, y)
       y = y + 10

  5. #5
    iScripter Eli's Avatar
    Join Date
    Mar 2012
    Posts
    3,764
    Mentioned
    492 Post(s)
    Tagged
    2 Thread(s)
    Quoted
    956 Post(s)
    Reputation
    586
    Rep Power
    10
    omg I get you wrong as hell lol sorry for that

    I use this way:

    Lua Code:
    function formatstaminaintotime(staminaAmount)
        if staminaAmount == 0 then
            return "00:00"
        else
            local nHours = string.format("%02.f", math.floor(staminaAmount/60))
            local nMins = string.format("%02.f", math.floor(staminaAmount - (nHours*60)))
            return nHours..":"..nMins
        end
    end
     
    if stamina >= 2400 then      
        addtextshadow('' ..formatstaminaintotime(stamina), rgbcolor(107, 142, 35), 75, y+275)
    elseif stamina < 2400 and stamina >= 840 then
          addtextshadow('' ..formatstaminaintotime(stamina), rgbcolor(255, 180, 4), 75, y+275)
    elseif stamina <= 840 then
          addtextshadow('' ..formatstaminaintotime(stamina), rgbcolor(178, 34, 34), 75, y+275)
    end

  6. #6
    iBot User
    Join Date
    May 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quoted
    3 Post(s)
    Reputation
    10
    Rep Power
    4
    Thanks BRO!!!!!!

    addtext('Stamina', x, y)
    addtext(string.format("%.2d:%.2d", stamina / 60, stamina % 60) .. 'h', 120, y)

    This works fine!
    CYA.

Posting Permissions

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