HOW I DO IT AKA: the absolute dummies method!!
NOTE: All credit must go to
Sluggo the author of the original tutorial of which I commit the heresy of modifying it in the authentic
Abbadon´s Clumsy Coding style!!
In your CLIENT workspace just do this for creating toggle keys:
In
hud.cpp Under
#include "vgui_scorepanel.h"
Put
bool g_bShowHudToggle;// Or whatever key you want
Inside
//DECLARE_MESSAGE(m_Logo, Logo)
int __MsgFunc_ResetHUD(const char *pszName, int iSize, void *pbuf)
{
return gHUD.MsgFunc_ResetHUD(pszName, iSize, pbuf );
Put
g_bShowHudToggle = false;
Inside
// This is called every time the DLL is loaded
void CHud :: Init( void )
{
Put
g_bShowHudToggle = false;
Now in
input.cppUnder
extern int g_iAlive;
Put
extern bool g_bShowHudToggle;
Under
kbutton_t in_graph; // Display the netgraph
Put
kbutton_t in_showhud;
Under
void IN_DuckUp(void) {KeyUp(&in_duck);}
Put
void IN_ShowHudToggle( void ) {g_bShowHudToggle = !g_bShowHudToggle;}
Now into
int CL_ButtonBits( int bResetState )
{
Put
//=============================
if ( g_bShowHudToggle )
{
Yourstuff here...
}
//==============================
And into
void InitInput (void)
{
Put
gEngfuncs.pfnAddCommand ( "showhud", IN_ShowHudToggle);
Probably into both
input.cpp and
hud.cpp you must put...
#include "vgui_TeamFortressViewport.h"
...because I cannot remember if, because I add the "showhud" stuff there (the function that shows and hides the Combat HUD), the compiler needs it to build the
client.dll.
Now in your
kb_act.lst file into the
yourmod\gfx\shell folder of your mod just add (I am using my code here as an example):
"showhud" "Combat Screen Reticle CSR ON"
I hope that it works for you too.