PDA

View Full Version : Registering your own cvars?



Xeno123
07-15-2009, 11:36 AM
I know it may be considered bad practice, but I'm attempting to register my own console variables in TF2.

ConVar speedhack_value("speedhack_value","5",0);
According to the SDK documentation, the constructor should automatically register the cvar with the engine. However, this is not the case. Any reasons why this might be/how I could manually register this?

true
07-15-2009, 12:17 PM
I have near-same problem too..
I'm trying to obfuscate well-known variables like described below: http://forum.gamedeception.net/showthread.php?t=7555 for OB.
Since there are some SDK differences I made such substutions:


// pCvar->m_pszName = newName;
*MakePtr(char**, &(pCvar->m_nFlags), -8) = newName;

and

// pNewVar->SetNext( 0 );
*MakePtr(int*, &(pNewVar->m_nFlags), -15) = NULL;


still unsure how to replace

pCvar->RegisterConCommandBase( pNewVar );

Xeno123
07-15-2009, 12:28 PM
Hmm, yep, same problem. The registerconcommandbase function does not exist in the OB SDK so I assume you need to recreate it.

b2k5
07-16-2009, 01:44 PM
how about you just put your cvar in the linked list at any point?

Xeno123
07-16-2009, 03:30 PM
What linked list? These are in-game cvars, not cvars specific to my hack.

monster64
07-16-2009, 05:12 PM
You can't just insert the node into the linked list because the size will not be updated. However, you can find the data structure they use to store the cvars, get a pointer to it, and then call its add or insert function.

Poumix
07-16-2009, 05:51 PM
ConVar_Register();