Member
|
08-29-2007
, 13:37
Re: hook console command
|
#9
|
Quote:
Originally Posted by L. Duke
With plugins using the Valve Server Plugin interface you can use this method:
Querying ConVars from Server Plugins
Also read this:
Querying conVars from Server DLL
To use this in a MMS plugin, just make the necessary changes to the interface header (unless the latest SDK release included that?) and then hook OnQueryCvarValueFinished
Code:
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, OnQueryCvarValueFinished, gServerDll, &g_MyPlugin, &MyPlugin::OnQueryCvarValueFinished, true);
|
for source plugin, all works ok i can see cvars
but not work with MM
i use
Code:
//Init our cvars/concmds
ConCommandBaseMgr::OneTimeInit(&g_Accessor);
//We're hooking the following things as POST, in order to seem like Server Plugins.
//However, I don't actually know if Valve has done server plugins as POST or not.
//Change the last parameter to 'false' in order to change this to PRE.
//SH_ADD_HOOK_MEMFUNC means "SourceHook, Add Hook, Member Function".
//Hook LevelInit to our function
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, LevelInit, m_ServerDll, &g_Myplugin, &Myplugin::LevelInit, true);
//Hook ServerActivate to our function
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, ServerActivate, m_ServerDll, &g_Myplugin, &Myplugin::ServerActivate, true);
//Hook GameFrame to our function
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, GameFrame, m_ServerDll, &g_Myplugin, &Myplugin::GameFrame, true);
SH_ADD_HOOK_MEMFUNC(IServerGameDLL, OnQueryCvarValueFinished, m_ServerDll, &g_Myplugin, &Myplugin::OnQueryCvarValueFinished, true);
and
Code:
//Declare the hooks we will be using in this file. Hooking will not compile without these.
//The macro naming scheme is SH_DECL_HOOKn[_void].
//If you have 5 parameters, it would be HOOK5. If the function is void, add _void.
//It stands for "SourceHook, Declare Hook".
SH_DECL_HOOK6(IServerGameDLL, LevelInit, SH_NOATTRIB, 0, bool, charconst *, charconst *, charconst *, charconst *, bool, bool);
SH_DECL_HOOK3_void(IServerGameDLL, ServerActivate, SH_NOATTRIB, 0, edict_t *, int, int);
SH_DECL_HOOK1_void(IServerGameDLL, GameFrame, SH_NOATTRIB, 0, bool);
SH_DECL_HOOK5_void(IServerGameDLL, OnQueryCvarValueFinished, SH_NOATTRIB, 0, QueryCvarCookie_t,edict_t *,EQueryCvarValueStatus,constchar *,constchar *);
OnQueryCvarValueFinished
not hook, not work with Metamod
where is the error?¿
|
|