View Single Post
fdxx
Member
Join Date: Oct 2020
Location: 0xdeadbeef
Old 09-22-2023 , 11:43   Re: [EXTENSION] Midhooks
Reply With Quote #2

Server crashes after trying, what am I doing wrong?

PHP Code:
/*
"Games"
{
    "left4dead2"
    {
        "Addresses"
        {
            "CLunge::IsAbilityReadyToFire"
            {
                "linux"
                {
                    "signature"    "CLunge::IsAbilityReadyToFire"
                    "offset"    "0xC8"
                }
            }
        }

        "Signatures"
        {
            "CLunge::IsAbilityReadyToFire"
            {
                "library"    "server"
                "linux"        "@_ZNK6CLunge20IsAbilityReadyToFireEv"
            }
        }
    }
}
*/

#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <sdktools>
#include <midhook>

public void OnPluginStart()
{
    
GameData hGameData = new GameData("midhook_test");

    
Address addr hGameData.GetAddress("CLunge::IsAbilityReadyToFire");
    
MidHook midhook = new MidHook(addrOnMidHook);
    if (!
midhook)
        
SetFailState("Failed to create midhook");
    
delete hGameData;
}

void OnMidHook(MidHookRegisters regs)
{
    
PrintToServer("--- OnMidHook ---"); // Server crashes immediately after printing

Attached Thumbnails
Click image for larger version

Name:	Snipaste_2023-09-22_23-35-13.jpg
Views:	52
Size:	100.6 KB
ID:	201606  
fdxx is offline