AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   [ORPHEU] Blocking function and sending new value (https://forums.alliedmods.net/showthread.php?t=170958)

OvidiuS 10-30-2011 17:27

[ORPHEU] Blocking function and sending new value
 
Is it possible to do something like this?
I want to hook _SV_CalcClientTime, i made a signature for linux
Code:

{
    "name"      : "SV_CalcClientTime",
    "arguments"  :
    [
        {
            "type" : "int"
        }
    ],
    "library"    : "engine",
    "identifiers":
    [
        {
            "os"    : "windows",
            "mod"  : "cstrike",
            "value" : 0
        },
        {
            "os"    : "linux",
            "mod"  : "cstrike",
            "value" : "_SV_CalcClientTime"
        }
    ]
}

First i'm not sure is it good, because IDA shows function name as
"_SV_CalcClientTime", but when i open function i see "SV_CalcClientTime"
still not sure what to use.

And i don't know how to block function and send different value?
I tried something like this, but it doesn't block
Code:

#include <amxmodx>
#include <orpheu>

public plugin_init()
{
        new OrpheuFunction:CalcTime = OrpheuGetFunction("SV_CalcClientTime","CalcTime")
        OrpheuRegisterHook(CalcTime, "CalculatePlayedTime", OrpheuHookPre)
}

public OrpheuHookReturn:CalculatePlayedTime()
        return OrpheuSupercede;


Arkshine 10-30-2011 17:56

Re: [ORPHEU] Blocking function and sending new value
 
You see well in IDA, or you can guess it returns a float. I don't see that in your config file.
You have another error where you have put '_' before for 'SV_CalcClientTime'. It's wrong.

Something like :
Code:

{
    "name"      : "SV_CalcClientTime",
    "library"    : "engine",
    "arguments"  :
    [
        {
            "type" : "int"
        }
    ],
    "return" :
    {
        "type" : "float"
    },
    "identifiers":
    [
        {
            "os"    : "windows",
            "mod"  : "cstrike",
            "value" : [0x55,0x8B,"*",0x83,"*","*",0xD9,"*","*","*","*","*",0x53,0x56,0x33,"*",0x57]
        },
        {
            "os"    : "linux",
            "mod"  : "cstrike",
            "value" : "SV_CalcClientTime"
        }
    ]
}



And the code would be :

Code:
#include <amxmodx> #include <orpheu> public plugin_init() {     OrpheuRegisterHook( OrpheuGetFunction("SV_CalcClientTime" ), "SV_CalcClientTime" ); } public OrpheuHookReturn:SV_CalcClientTime( const handle ) {     OrpheuSetReturn( YourNewFloatValue );     return OrpheuOverride; }

OvidiuS 10-31-2011 12:35

Re: [ORPHEU] Blocking function and sending new value
 
i guess it's working, but it seems that i hooked wrong function xD
I wanted to modify bot time on server.
Thank you Arkshine.


All times are GMT -4. The time now is 14:22.

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