AlliedModders (
-   Coding MM:S Plugins & SM Extensions (
-   -   Declare one hook in multiple cpp files (

kadet.89 05-27-2021 16:41

Declare one hook in multiple cpp files
I need to hook IServerEntity::SetModelIndex founction in multiple cpp files.
I do it this way in the first file:
SH_DECL_HOOK1_void(IServerEntity, SetModelIndex, SH_NOATTRIB, 0, int)
and in the second:
SH_DECL_HOOK1_void(IServerEntity, SetModelIndex, SH_NOATTRIB, 1, int)

I get this error:
PHP Code:

/usr/bin/lderrorfileone.omultiple definition of '__SourceHook_FHAddIServerEntitySetModelIndex(void*, SourceHook::ISourceHook::AddHookMode, bool, fastdelegate::FastDelegate1<int, void>)'
/usr/bin/ldfiletwo.oprevious definition here
/usr/bin/lderrorfileone.omultiple definition of '__SourceHook_FHRemoveIServerEntitySetModelIndex(void*, bool, fastdelegate::FastDelegate1<int, void>)'
/usr/bin/ldfiletwo.oprevious definition here
errorld returned 1 exit status 

Is there a beautiful way to solve this problem?

All times are GMT -4. The time now is 17:21.

Powered by vBulletin®
Copyright ©2000 - 2021, vBulletin Solutions, Inc.