AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Combine 2 orpheu plugin functions (https://forums.alliedmods.net/showthread.php?t=209007)

EDUTz 02-19-2013 23:28

Combine 2 orpheu plugin functions
 
Hi. I've tried to combine 2 plugins using same orpheu function, and i can't get it to work. obviously same function is registered twice as same as the hook. What can i do ?

Code:

new OrpheuHook:handlePrintf

public TaskShowFPS()
{
.....
new OrpheuHook:hHandlePrintf = OrpheuRegisterHook( OrpheuGetFunction( "Con_Printf" ), "Con_Printf" );
}

public OrpheuHookReturn:Con_Printf( const a[ ], const szMessage[ ] )
{
    copy( g_szStatsResult, charsmax( g_szStatsResult ), szMessage );
   
    return OrpheuSupercede;
}

public OrpheuHookReturn:OrpheuHookPre(const a[], const b[] , const c[] )
{
   
  handlePrintf = OrpheuRegisterHook( OrpheuGetFunction( "Con_Printf" ), "Con_Printf" , OrpheuHookPre);
  return OrpheuIgnored;
}

public OrpheuHookReturn:Con_Printf(const a[], const b[])
{
  if (containi(b,"testing")>-1)
  {
      new msg[256]
      copy(msg,255,b)
      del_log(msg)
      return OrpheuSupercede;
  }
     
  return OrpheuIgnored;
}


fysiks 02-20-2013 00:03

Re: Combine 2 orpheu plugin functions
 
Don't combine them. This is the best answer 95% of the time. You will need to give a good reason for anyone to give a different answer.


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

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