Raised This Month: $119 Target: $400
 29% 

Solved SH_ADD_HOOK Don't work.


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
201724
Member
Join Date: May 2011
Old 04-06-2020 , 04:27   SH_ADD_HOOK Don't work.
Reply With Quote #1

Code:
bool MetaProtect::SDK_OnMetamodLoad(ISmmAPI *ismm, char *error, size_t maxlen, bool late)
{
    ConMsg("SDK_OnMetamodLoad\n");

    gpGlobals = ismm->GetCGlobals();

	GET_V_IFACE_CURRENT(GetEngineFactory, helpers, IServerPluginHelpers, INTERFACEVERSION_ISERVERPLUGINHELPERS);
	GET_V_IFACE_CURRENT(GetEngineFactory, icvar, ICvar, CVAR_INTERFACE_VERSION);
	GET_V_IFACE_ANY(GetServerFactory, gameclients, IServerGameClients, INTERFACEVERSION_SERVERGAMECLIENTS);
	GET_V_IFACE_ANY(GetServerFactory, playerinfomanager, IPlayerInfoManager, INTERFACEVERSION_PLAYERINFOMANAGER);

    ConMsg("[!!!!!!!!!!!!!!!!!]gameclients:%p\n",gameclients);
    ConMsg("[!!!!!!!!!!!!!!!!!]playerinfomanager:%p\n",playerinfomanager);
    ConMsg("[!!!!!!!!!!!!!!!!!]helpers:%p\n",helpers);
    g_pCVar = icvar;
    ConVar_Register(0, &s_BaseAccessor);
    
    SH_ADD_HOOK(IServerGameClients, ClientConnect, gameclients, SH_MEMBER(this, &MetaProtect::OnClientConnect), false);
    SH_ADD_HOOK(IServerGameClients, ClientConnect, gameclients, SH_MEMBER(this, &MetaProtect::OnClientConnect_Post), true);
    SH_ADD_HOOK(IServerGameClients, ClientCommand, gameclients, SH_MEMBER(this, &MetaProtect::OnClientCommand), false);

    SH_ADD_HOOK(IServerGameClients, ClientPutInServer, gameclients, SH_MEMBER(this, &MetaProtect::OnClientPutInServer), true);
    SH_ADD_HOOK(IServerGameClients, ClientDisconnect, gameclients, SH_MEMBER(this, &MetaProtect::OnClientDisconnect), false);
    SH_ADD_HOOK(IServerGameClients, ClientDisconnect, gameclients, SH_MEMBER(this, &MetaProtect::OnClientDisconnect_Post), true);

    return true;
}
When I installed these hooks on the csgo server, he didn't get the correct call? I don't know why. Do you need to add additional processing?


It was I who modified the interface function of mmsource that caused the interface error. I restored it and worked it out.
__________________
Half-Life Unofficial Master Server

http://hlmaster.net

Last edited by 201724; 04-06-2020 at 05:00.
201724 is offline
Send a message via MSN to 201724
Reply


Thread Tools
Display Modes

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 23:16.


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