View Single Post
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 01-04-2020 , 10:20   Hooking IServerTools finctions leads to compile-time errors
Reply With Quote #1

I'm trying to hook SetKeyValue functions from IServerTools:

PHP Code:
    virtual bool SetKeyValueCBaseEntity *pEntity, const char *szField, const char *szValue ) = 0;
    
virtual bool SetKeyValueCBaseEntity *pEntity, const char *szFieldfloat flValue ) = 0;
    
virtual bool SetKeyValueCBaseEntity *pEntity, const char *szField, const Vector &vecValue ) = 0
If I hook only the first one, it goes fine, but for the second and third I get errors:
error: redefinition of '__SourceHook_FHCls_IServerToolsSetKeyValue0'
Though the functions are not the same and have different parameters.
What is the proper way to define them?

Here my corrent definitions:
PHP Code:
SH_DECL_HOOK3(IServerToolsSetKeyValueSH_NOATTRIB0boolvoid *, const char *, const char *  );
SH_DECL_HOOK3(IServerToolsSetKeyValueSH_NOATTRIB0boolvoid *, const char *, float  );
SH_DECL_HOOK3(IServerToolsSetKeyValueSH_NOATTRIB0boolvoid *, const char *, const Vector &  ); 

Last edited by kadet.89; 01-14-2020 at 08:41.
kadet.89 is offline
Send a message via Skype™ to kadet.89