View Single Post
Author Message
kadet.89
Veteran Member
Join Date: Nov 2012
Location: Serbia
Old 10-07-2017 , 09:16   [CSS] Detour template class function
Reply With Quote #1

I'm trying to detour this function:

PHP Code:
bool CBot<CCSPlayer>::IsPlayerLookingAtMe(CBasePlayer *, float) const 
Linux signature:
PHP Code:
_ZNK4CBotI9CCSPlayerE19IsPlayerLookingAtMeEP11CBasePlayerf 
I get this gamedata:
PHP Code:
            "CBot_CCSPlayer::IsPlayerLookingAtMe"
            
{
                
"library"        "server"
                "linux"            "@_ZNK4CBotI9CCSPlayerE19IsPlayerLookingAtMeEP11CBasePlayerf"
            

PHP Code:
DETOUR_DECL_MEMBER2(IsPlayerLookingAtMeboolCBasePlayer *, playerfloatepsilon)
{
    return 
DETOUR_MEMBER_CALL(IsPlayerLookingAtMe)(playerepsilon);
}
bool CreateIsPlayerLookingAtMeDetour()
{
    
DIsPlayerLookingAtMe =  DETOUR_CREATE_MEMBER(IsPlayerLookingAtMe"CBot_CCSPlayer::IsPlayerLookingAtMe");

    if(
DIsPlayerLookingAtMe != NULL)
    {
        
DIsPlayerLookingAtMe->EnableDetour();
        return 
true;
    }
    
g_pSM->LogError(myself"CBot<CCSPlayer>::IsPlayerLookingAtMe detour could not be initialized");
    return 
false;

After calling CreateIsPlayerLookingAtMeDetour I get this message:
"CBot<CCSPlayer>::IsPlayerLookingAtMe detour could not be initialized" and the detour doesn't work. I compared this function with the other i've detoured and the only difference is that it's class is a template class... Any ideas ?
kadet.89 is offline
Send a message via Skype™ to kadet.89