Declare a function with return type and parameters matching the prototype below:
void ChangeCallback( IConVar* var, const char* pOldValue, float pOldValue );
Then implement it (read the old value into a temporary string, say, a
CUtlString, strip the spaces, then set the new value using
var->SetValue(const char*))
In your init code put the following
empty_cvar.InstallChangeCallback(&ChangeCallback);
OR
Modify the constructor to look like:
static ConVar empty_cvar("plugin_empty", "0", 0, "Example plugin
cvar", &ChangeCallback);
On Wed, Dec 9, 2009 at 8:05 PM, JoeX <[email protected]> wrote:
> first.... i want to thank AzuiSleet, Saul Rennison and Jacob Heidt for their
> support in the last topic about "tf2 client plugin question", your help is
> much appreciated. Thank you again
>
> in documentation, i can't find how to run code, when the user change the
> value of a cvar...
>
> i got this....
>
> static ConVar empty_cvar("plugin_empty", "0", 0, "Example plugin cvar");
>
> i want to remove whitespaces from user...., that means:
>
> (console)
> ]plugin_empty hola amigos
> ]plugin_empty
> plugin_empty = "holaamigos" (def = "0")
> Example plugin cvar
>
> but..... how to make my own code, to "intercept" plugin_empty mdifications?
> like CON_COMMAND, with a code block...
>
> cheers from Chile! (LA)
> _______________________________________________
> To unsubscribe, edit your list preferences, or view the list archives, please
> visit:
> http://list.valvesoftware.com/mailman/listinfo/hlcoders
>
>
_______________________________________________
To unsubscribe, edit your list preferences, or view the list archives, please
visit:
http://list.valvesoftware.com/mailman/listinfo/hlcoders