Raised This Month: $32 Target: $400
 8% 

Solved Remove Orpheu Functions from Code


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 12-06-2022 , 02:55   Remove Orpheu Functions from Code
Reply With Quote #1

Hi guys i have a portion of code, (not my plugin) and most of the Signatures are 'out of date' works only on HLDS 7 build, it's an old addons, and i cannot use it anymore, it has the folowing part in it that uses Orpheu, can someone explain some functions that does the same job using default AMX Mod X system and reHLDS with reGameDLL (latest) can it be reAPI too, just whanna get rid of Signatures

Code:
PHP Code:
new g_pGameRules;

public 
plugin_init()
{
    static 
OrpheuFunction:handleFunc;
    
handleFunc OrpheuGetFunctionFromObjectg_pGameRules"CheckWinConditions""CGameRules" )
    
OrpheuRegisterHookhandleFunc"OnCheckWinConditions_Pre" OrpheuHookPre );
}

#define MemorySet(%0,%1)    OrpheuMemorySetAtAddress( g_pGameRules, %0, 1, %1 )
#define MemoryGet(%0)        OrpheuMemoryGetAtAddress( g_pGameRules, %0 )

public OnInstallGameRules()
{
    
g_pGameRules OrpheuGetReturn();
}

public 
plugin_precache()
{    
    
OrpheuRegisterHookOrpheuGetFunction"InstallGameRules" ), "OnInstallGameRules"OrpheuHookPost );
}

public 
OrpheuHookReturn:OnCheckWinConditions_Pre( const handleGameRules )
{    
    static 
alivehumansalivezombies
    
static a
    alivehumans 
0
    alivezombies 
0
    
for( 133a++ )
    {
        if( !
is_user_connected(a) || !is_user_alive(a) ) continue
        if( 
zp_teamazombie ) ) alivezombies++
    }
    
    for( 
133a++ )
    {
        if( !
is_user_connected(a) || !is_user_alive(a) ) continue
        if( !
zp_teamazombie ) ) alivehumans++
    }

    if( 
alivezombies == && z_mode != )
        return 
OrpheuIgnored;
    
    if( 
alivehumans == && z_mode != )
        return 
OrpheuIgnored;
    
    return 
OrpheuSupercede;

Thanks
Ill attach the outdated orpheu functions too in the .ZIP file

reAPI has that function but something im not doing well
PHP Code:
public plugin_init ( ) {
    
RegisterHookChain(RG_CSGameRules_CheckWinConditions"Fw_CheckMapConditions_Pre"1);
}

public 
Fw_CheckMapConditions_Pre()
{    
    static 
alivehumansalivezombies
    
static a
    alivehumans 
0
    alivezombies 
0
    
    
for( 133a++ )
    {
        if( !
is_user_connected(a) || !is_user_alive(a) ) continue
        if( 
zp_teamazombie ) ) alivezombies++
    }
    
    for( 
133a++ )
    {
        if( !
is_user_connected(a) || !is_user_alive(a) ) continue
        if( !
zp_teamazombie ) ) alivehumans++
    }

https://github.com/s1lentq/reapi/blo..._const.inc#L29
Attached Files
File Type: zip orpheu.zip (4.6 KB, 34 views)
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers

Last edited by CryWolf; 12-06-2022 at 13:15.
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 12-06-2022 , 05:34   Re: Remove Orpheu Functions from Code
Reply With Quote #2

PHP Code:
public plugin_init ( ) {
    
RegisterHookChain(RG_CSGameRules_CheckWinConditions"Fw_CheckMapConditions_Pre"1);
}

public 
Fw_CheckMapConditions_Pre()
{    
    static 
alivehumansalivezombies
    
static a
    alivehumans 
0
    alivezombies 
0
    
    
for( 133a++ )
    {
        if( !
is_user_connected(a) || !is_user_alive(a) ) continue
        if( 
zp_teamazombie ) ) alivezombies++
    }
    
    for( 
133a++ )
    {
        if( !
is_user_connected(a) || !is_user_alive(a) ) continue
        if( !
zp_teamazombie ) ) alivehumans++
    }

    if( 
alivezombies == && z_mode != )
        return 
HC_SUPERCEDE;
    
    if( 
alivehumans == && z_mode != )
        return 
HC_SUPERCEDE;

__________________

Last edited by deprale; 12-06-2022 at 05:34.
deprale is offline
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 12-06-2022 , 05:42   Re: Remove Orpheu Functions from Code
Reply With Quote #3

Thanks, just Quick Question
Sould not
return OrpheuIgnored; be -> return HC_CONTINUE; ?
Like this
PHP Code:
    if( alivezombies == && z_mode != )
        
// return OrpheuIgnored;
        
return HC_CONTINUE;
    
    if( 
alivehumans == && z_mode != )
        
// return OrpheuIgnored;
        
return HC_CONTINUE;
    
    return 
HC_SUPERCEDE;
    
// return OrpheuSupercede; 
hmm
Code:
/**
* Hookchain return types
*/
enum
{
	HC_CONTINUE = 0, // Plugin didn't take any action
	HC_SUPERCEDE,    // Skip real function, use my return value
	HC_BREAK         // Skip all forwards and real function, use my return value
                     // @note Warning: Be very careful, using this type of return will skip calls for all following AMXX plugins
};
hmm
Code:
warning 209: function "Fw_CheckMapConditions_Pre" should return a value
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers

Last edited by CryWolf; 12-06-2022 at 05:53.
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
deprale
Senior Member
Join Date: Oct 2018
Location: Leeds
Old 12-06-2022 , 09:06   Re: Remove Orpheu Functions from Code
Reply With Quote #4

you should return HC_CONTINUE before the function end because you're not altering anything, HC_SUPERCEDE will stop the round from ending.

PHP Code:
    if( alivezombies == && z_mode != )
        return 
HC_SUPERCEDE;
    
    if( 
alivehumans == && z_mode != )
        return 
HC_SUPERCEDE;

    return 
HC_CONTINUE;

I don't remember maybe you would have to switch places (supercede -> continue and viceversa), right now I cannot test for you unfortunately as I'm not home.
__________________

Last edited by deprale; 12-06-2022 at 09:08.
deprale is offline
CryWolf
Veteran Member
Join Date: Jul 2008
Location: Romania
Old 12-06-2022 , 13:15   Re: Remove Orpheu Functions from Code
Reply With Quote #5

OK, thank you, so i did for now, ill test bouth ways in time!
__________________
I dont walk trough this world with fear in my heart.
www.dark-arena.com L4D, CS1.6, CZ Servers
CryWolf is offline
Send a message via MSN to CryWolf Send a message via Yahoo to CryWolf
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 16:37.


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