Raised This Month: $ Target: $400
 0% 

hook console command


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jimihendrix
Member
Join Date: May 2007
Old 08-21-2007 , 13:47   hook console command
Reply With Quote #1

hi
i cant hook cl_minmodels
i try use some code for this from this forum like CON_COMMAND
but i cant hook cl_minmodels

hpw i can do it???

thanks
jimihendrix is offline
BAILOPAN
Join Date: Jan 2004
Old 08-21-2007 , 15:31   Re: hook console command
Reply With Quote #2

IServerGameClients::ClientCommand is where non-gamedll console commands pass through
__________________
egg
BAILOPAN is offline
jimihendrix
Member
Join Date: May 2007
Old 08-21-2007 , 16:36   Re: hook console command
Reply With Quote #3

not work for me
i test with other commands and works in clientcommand
but cl_minmodels not work

Code:
void Myplugin::ClientCommand(edict_t *pEntity)
{
if (!pEntity || pEntity->IsFree()) RETURN_META(MRES_IGNORED);
gpGlobals = g_SMAPI->pGlobals();
constchar *pCmd = m_Engine->Cmd_Argv(0);

if (stricmp(pCmd,"cl_minmodels") == 0)
{
 //..........
}
(...)
this code works with my own commands but not with cl_ comands
jimihendrix is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 08-21-2007 , 16:39   Re: hook console command
Reply With Quote #4

cl_minmodels is probably a cvar not a client command
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
jimihendrix
Member
Join Date: May 2007
Old 08-21-2007 , 17:01   Re: hook console command
Reply With Quote #5

yes true sorry , im little noob
i will try hook cvars
thanks
jimihendrix is offline
jimihendrix
Member
Join Date: May 2007
Old 08-21-2007 , 18:17   Re: hook console command
Reply With Quote #6

i try with
Code:
constchar * pCmdx = m_Engine->GetClientConVarValue( m_Engine->IndexOfEdict(pEntity), "cl_minmodels" );
not works ...

but with cl_updaterate works

i cant see client cvar of cl_minmodels???
jimihendrix is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 08-21-2007 , 18:48   Re: hook console command
Reply With Quote #7

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);
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
jimihendrix
Member
Join Date: May 2007
Old 08-21-2007 , 19:51   Re: hook console command
Reply With Quote #8

ok thanks
jimihendrix is offline
jimihendrix
Member
Join Date: May 2007
Old 08-29-2007 , 13:37   Re: hook console command
Reply With Quote #9

Quote:
Originally Posted by L. Duke View Post
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?¿
jimihendrix is offline
BAILOPAN
Join Date: Jan 2004
Old 08-29-2007 , 17:39   Re: hook console command
Reply With Quote #10

What? I don't think you actually stated what the problem is.
__________________
egg
BAILOPAN is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 10:26.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode