Results 1 to 7 of 7

Thread: Show FPS in Hud

  1. #1
    Private
    Join Date
    Oct 2013
    Posts
    48
    Thanks
    10
    Thanked 4 Times in 2 Posts

    Show FPS in Hud

    Hey guys..
    I'm trying to show the current value of "com_maxfps" in my custom hud.
    I've done that with menu files but of course its only working with pre-defined values.
    I want to change the hud to "FPS: Unknown" if the FPS is not defined.
    Sadly its not possible to use "openMenuOnDvar" more then 17 times in a menu so i cant define all 1000 FPS steps...
    Is there any way to get it working?

  2. #2
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    hud.menu
    PHP Code:
    itemDef
    {
        
    rect 320 240 0 0
        style WINDOW_STYLE_DVAR
        dvar com_maxfps
        dvarTest ui_showFPS
        hideDvar
        
    {
            
    "0";
        }

    player.gsc
    PHP Code:
    init()
    {
        
    level.hud_showFPS getCvarInt"scr_hud_showFPS" );
    }

    onPlayerSpawned()
    {
        
    player setClientCvar"ui_showFPS" level.hud_showFPS );

    Last edited by serthy; 21st October 2013 at 21:14.

  3. The Following User Says Thank You to serthy For This Useful Post:

    kung foo man (21st October 2013)

  4. #3
    Private
    Join Date
    Oct 2013
    Posts
    48
    Thanks
    10
    Thanked 4 Times in 2 Posts
    No, I think you got me wrong..
    I want to show the current Client-FPS in the hud.
    If the client has 125 FPS the hud shows "FPS: 125"
    If the client has 250 FPS the hud shows "FPS: 250"
    If the client has 333 FPS the hud shows "FPS: 333"
    But if the client hast any other FPS then 125, 250 or 333 the hud shows "FPS: Unknown"

  5. #4
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    Should exactly do this.
    dvar com_maxfps will print the clients current value in com_maxfps

    you can do things like this:

    draw fps if it is 125,250 or 333, otherwise hide this itemdef
    PHP Code:
    dvar com_maxfps
    dvarTest com_maxfps
    showDvar
    {
        
    "125";
        
    "250";
        
    "333";

    and another one with this, hide this when its 125,250 or 333, in all other cases show this one
    PHP Code:
    text "Unknown"
    dvarTest com_maxfps
    hideDvar
    {
        
    "125";
        
    "250";
        
    "333";

    If you want the CURRENT client FPS a-la 327, there is no way, except for the cg_drawfps-one
    Last edited by serthy; 22nd October 2013 at 11:53.

  6. #5
    Private
    Join Date
    Oct 2013
    Posts
    48
    Thanks
    10
    Thanked 4 Times in 2 Posts
    Yes, i know "showDvar" and "hideDvar" but how could i use this to show the FPS on the Hud?
    Like this:

  7. #6
    Sergeant serthy's Avatar
    Join Date
    Nov 2012
    Posts
    450
    Thanks
    96
    Thanked 296 Times in 188 Posts
    you have to force the dvar and set it to a client variable and draw the variable on the hud

    player.fps = 333; player.hud_fps setValue( player.fps ); player setClientCvar( "com_maxfps" , player.fps );

  8. #7
    Assadministrator IzNoGoD's Avatar
    Join Date
    Aug 2012
    Posts
    1,718
    Thanks
    17
    Thanked 1,068 Times in 674 Posts
    I PM-ed you with my xfire.

    The way i did it is simple: i only detect those 5 fpsses, if its none of those, its MIX.

Posting Permissions

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