AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Cvar Util problem, Game commencing (https://forums.alliedmods.net/showthread.php?t=317982)

orel56000 08-07-2019 12:11

Cvar Util problem, Game commencing
 
Hey, I'm typing to block Game Commencing, I tryed to install infinity round, but the Cvar Util module crash my server, even with its fix plugin, so I don't really know if this module is necessary to block it, so can someone help me block game commencing without the infinity round?

that was my sketch:

Code:

new g_pGameRules;
new OrpheuHook:HandleHookCheckWinConditionsPre;
enum GameRulesMembers
{
    m_iRoundWinStatus,
    m_bFirstConnected,
    m_bMapHasBombTarget,
    m_bBombDefused,
    m_bTargetBombed,
    m_iHostagesRescued,
    m_bMapHasRescueZone,
    m_iMapHasVIPSafetyZone,
    m_bMapHasEscapeZone,
    m_pVIP,
    m_iNumTerrorist,
    m_iNumSpawnableTerrorist,
    m_iNumCT,
    m_iNumSpawnableCT,
    m_iHaveEscaped,
    m_iNumEscapers,
    m_flRequiredEscapeRatio,
};
 new const GameRulesMI[ GameRulesMembers ][] =
{
    "m_iRoundWinStatus",
    "m_bFirstConnected",
    "m_bMapHasBombTarget",
    "m_bBombDefused",
    "m_bTargetBombed",
    "m_iHostagesRescued",
    "m_bMapHasRescueZone",
    "m_iMapHasVIPSafetyZone",
    "m_bMapHasEscapeZone",
    "m_pVIP",
    "m_iNumTerrorist",
    "m_iNumSpawnableTerrorist",
    "m_iNumCT",
    "m_iNumSpawnableCT",
    "m_iHaveEscaped",
    "m_iNumEscapers",
    "m_flRequiredEscapeRatio"
};

#define get_mp_pdata(%1)    ( OrpheuMemoryGetAtAddress( g_pGameRules, GameRulesMI[ %1 ] ) )

public plugin_init() {
        register_plugin(PLUGIN, VERSION, AUTHOR)
        static OrpheuFunction:handleFunc;
        HandleHookCheckWinConditionsPre = OrpheuRegisterHook( handleFunc, "OnCheckWinConditions_Pre" , OrpheuHookPre );

}

public OrpheuHookReturn:OnCheckWinConditions_Pre( const handleGameRules )
{
        ColorChat(0, "public");
        if( isGameCommencing() )
        {
                ColorChat(0, "Game comm");
                return  OrpheuSupercede;
        }
        return OrpheuIgnored;
}


bool:isGameCommencing()
{
        return !get_mp_pdata( m_bFirstConnected ) && get_mp_pdata( m_iNumSpawnableTerrorist ) && get_mp_pdata( m_iNumSpawnableCT );
}

the OnCheckWinConditions_Pre just never called

CrazY. 08-07-2019 14:13

Re: Cvar Util problem, Game commencing
 
Code:
static OrpheuFunction:handleFunc; HandleHookCheckWinConditionsPre = OrpheuRegisterHook( handleFunc, "OnCheckWinConditions_Pre" , OrpheuHookPre );
:arrow:
Code:
new OrpheuFunction:handleFunc = OrpheuGetFunction( "CheckWinConditions", "CHalfLifeMultiplay" ); HandleHookCheckWinConditionsPre = OrpheuRegisterHook( handleFunc, "OnCheckWinConditions_Pre" , OrpheuHookPre );

Also, I suggest you post the signature for CheckWinConditions that you're using.

orel56000 08-07-2019 15:14

Re: Cvar Util problem, Game commencing
 
Quote:

Originally Posted by CrazY. (Post 2662351)
Code:
static OrpheuFunction:handleFunc; HandleHookCheckWinConditionsPre = OrpheuRegisterHook( handleFunc, "OnCheckWinConditions_Pre" , OrpheuHookPre );
:arrow:
Code:
new OrpheuFunction:handleFunc = OrpheuGetFunction( "CheckWinConditions", "CHalfLifeMultiplay" ); HandleHookCheckWinConditionsPre = OrpheuRegisterHook( handleFunc, "OnCheckWinConditions_Pre" , OrpheuHookPre );

Also, I suggest you post the signature for CheckWinConditions that you're using.

I don't have CheckWinConditions file, but that because I took this line from the infinity round plugin, which don't have it as well(I couldn't find any file named CheckWinConditions in his .zip file) maybe I'm wrong, and I just need to search and add it

Edit: I just added the signature CheckWinConditions and its still not working:
Code:

{
    "name"    : "CheckWinConditions",
    "class"  : "CGameRules",
    "library" : "mod",
    "indexes" :
    [
        {
            "os"    : "windows",
            "mod"  : "cstrike",
            "value" : 65
        },
        {
            "os"    : "linux",
            "mod"  : "cstrike",
            "value" : 65
        }
    ]
}


Natsheh 08-07-2019 17:48

Re: Cvar Util problem, Game commencing
 
You can find all signatures you need in my jailbreak mod addons or if you search.

orel56000 08-07-2019 17:54

Re: Cvar Util problem, Game commencing
 
Quote:

Originally Posted by Natsheh (Post 2662382)
You can find all signatures you need in my jailbreak mod addons or if you search.

there's an anti commencing in there? because i'm not sure if the signature is my problem

CrazY. 08-07-2019 19:16

Re: Cvar Util problem, Game commencing
 
Delete the one you've now and put this in amxmodx/configs/orpheu/functions/CHalfLifeMultiplay, check if that solve your problem.
Code:

{
    "name"      : "CheckWinConditions",
    "class"    : "CHalfLifeMultiplay",
    "library"  : "mod",
    "identifiers" :
    [
        {
            "os"    : "windows",
            "mod"  : "cstrike",
            "value" : [0x83,"*","*",0x53,0x55,0x8B,"*",0x56,0x33,"*",0x57,0x8A,"*","*","*","*"]
        }, 
        { 
            "os"    : "linux", 
            "mod"  : "cstrike", 
            "value" : "_ZN18CHalfLifeMultiplay18CheckWinConditionsEv" 
        }
    ]
}


orel56000 08-08-2019 00:00

Re: Cvar Util problem, Game commencing
 
Quote:

Originally Posted by CrazY. (Post 2662396)
Delete the one you've now and put this in amxmodx/configs/orpheu/functions/CHalfLifeMultiplay, check if that solve your problem.
Code:

{
    "name"      : "CheckWinConditions",
    "class"    : "CHalfLifeMultiplay",
    "library"  : "mod",
    "identifiers" :
    [
        {
            "os"    : "windows",
            "mod"  : "cstrike",
            "value" : [0x83,"*","*",0x53,0x55,0x8B,"*",0x56,0x33,"*",0x57,0x8A,"*","*","*","*"]
        }, 
        { 
            "os"    : "linux", 
            "mod"  : "cstrike", 
            "value" : "_ZN18CHalfLifeMultiplay18CheckWinConditionsEv" 
        }
    ]
}


if you read my code, you can see I added two checks, one says public when the public called and one says game comm when it detect game commencing, it shows the public message but dosen't show the game comm message, which means its successfully hooked the public but couldn't detect if its a game commencing.


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

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