News:

Come Chat with us live! Learn how HERE!

Main Menu

how can I create cvars for huds?

Started by Shifty, November 17, 2010, 04:11:52 AM

Shifty

I was looking through some hud files recently and I found that in some huds have this kinda thing:

cvartest cg_whatever
showcvar { 1 }

commented out. Is this used to create cvars such as whether or not to make the radar fullscreen, eg /cg_fullscreenscanner 1 or:


cvartest cg_fullscreenscanner
showcvar { 1 }

?

because I have tried that but it never seems to work for me. Is there something I am doing wrong?


Thanks

Meisseli

Create a new cvarseta cg_cHairColor "1" for example.

QuoteitemDef
    {
      name "chompers"
      rect 312 232 16 16
      visible 1
        cvartest cg_cHairColor
        showCvar { 1 }

      decoration
      forecolor 1.0 0.0 0.0 0.6
      style WINDOW_STYLE_SHADER
      background "gfx/2d/crosshair-alien.tga"
    }
In this example the item will be shown only if cg_cHairColor equals to 1. There's also hideCvar that does the opposite.