AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Orpheu help (https://forums.alliedmods.net/showthread.php?t=156857)

drekes 05-13-2011 06:42

Orpheu help
 
I was playing around with the func_tanks using orpheu.
The idea was to make like a cooldown for it.
I hooked CFunkTank::StartControl but when i use a func_tank, my game freezes.
I don't understand why this is happening, i only hooked the function.

I tried to print a msg at first but then commented it because of the crashes

Tested on map: am_gunattack_v3
PHP Code:

#include <amxmodx>
#include <orpheu>

#define VERSION     "1.0.0"


public plugin_init()
{
    
register_plugin("Func Tank"VERSION"Drekes");
    
    
OrpheuRegisterHook(OrpheuGetFunction("StartControl""CFuncTank"), "CFuncTankStartControl");
}


public 
CFuncTankStartControl(id)
{
    
// client_print(0, print_chat, "StartControl called");


Code:

{
    "name"        : "StartControl",
    "class"      : "CFuncTank",
    "library"    : "mod",
    "arguments" :
    [
        {
            "type" : "CBasePlayer *"
        }
    ],
    "identifiers":
    [
        {
            "os"    : "windows",
            "mod"    : "cstrike",
            "value"    : [0x74,0x07,0x5F,0x33,0xC0,0x5E,0xC2,0x04,0x00,0x8B,0x86,0x04,0x01,0x00,0x00,0x8B]
        },
        {
            "os"    : "linux",
            "mod"  : "cstrike",
            "value" : "StartControl__9CFuncTankP11CBasePlayer"
        }
    ]
}


Arkshine 05-13-2011 06:49

Re: Orpheu help
 
StartControl returns a bool. It should be specified in the signature file.

drekes 05-13-2011 07:06

Re: Orpheu help
 
I updated the signature and it is validated when the server starts but it still crashes.

Arkshine 05-13-2011 07:18

Re: Orpheu help
 
Why your signature doesn't start from the function start ?

drekes 05-13-2011 07:23

Re: Orpheu help
 
I don't understand what you mean

EDIT: fixed a typo in the function name, but it still crashes

Arkshine 05-13-2011 07:46

Re: Orpheu help
 
Code:

.text:10085BC0                              CFuncTank__StartControl proc near      ; CODE XREF: sub_10085F90+6Cp
.text:10085BC0
.text:10085BC0                              arg_0          = dword ptr  4
.text:10085BC0
.text:10085BC0 56                                            push    esi
.text:10085BC1 8B F1                                        mov    esi, ecx
.text:10085BC3 57                                            push    edi
.text:10085BC4 8B 86 88 00 00 00                            mov    eax, [esi+88h]
.text:10085BCA 85 C0                                        test    eax, eax        ; Logical Compare
.text:10085BCC 74 07                                        jz      short loc_10085BD5 ; Jump if Zero (ZF=1)
.text:10085BCE 5F                                            pop    edi
.text:10085BCF 33 C0                                        xor    eax, eax        ; Logical Exclusive OR
.text:10085BD1 5E                                            pop    esi
.text:10085BD2 C2 04 00                                      retn    4              ; Return Near from Procedure
.text:10085BD5                              ; ---------------------------------------------------------------------------
.text:10085BD5
.text:10085BD5                              loc_10085BD5:                          ; CODE XREF: CFuncTank__StartControl+Cj
.text:10085BD5 8B 86 04 01 00 00                            mov    eax, [esi+104h]

You don't start the signature from the start. (56)

By the way, are you testing under linux or windows ?

drekes 05-13-2011 07:57

Re: Orpheu help
 
O_O
Can't believe i did that.
It works like a charm now :)
Thanks


All times are GMT -4. The time now is 04:25.

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