Talk:Orange Box server plugins

From Valve Developer Community
Jump to: navigation, search

OK, for those who are developing plugins, it is not really necessary to implement IConCommandBaseAccessor and use ConVar_Register, your console command will never appear in autocomplete list.

Instead, use this code to add console commands/vars:

ConCommand myCommand("my_command", myCommand_f, "My plugin's command.", FCVAR_NONE, myCommand_completion_f);

and inside Load() function of your plugin do:

pCvar->RegisterConCommand( &myCommand); // Of course your pCvar should be initialized before.

and inside UnLoad() function of your plugin do:

pCvar->UnregisterConCommand( &myCommand);

--borzh62 10 Sept 2012