AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Invalid Index Data (https://forums.alliedmods.net/showthread.php?t=246510)

HamletEagle 08-18-2014 13:13

Invalid Index Data
 
So, I tried to hook CBasePlayer::HostageUse function and I get this error( oprheu config ):

Code:

Parsing folder "CBasePlayer" started
                        Parsing file "HostageUse" started
                                Invalid index data
                                FAILED

My signature file looks like this:

Code:
{     "name" : "HostageUse",     "class" : "CBasePlayer",     "library" : "mod",         "indexes" :     [         {             "os" : "windows",             "mod" : "cstrike",             "value" : [0x56,0x8B,0xF1,0xF6,0x86,0x30,0x03,0x00,0x00,0x10,"*","*",0x8B,0x86,0xC8,0x01]         },         {             "os" : "linux",             "mod" : "cstrike",             "value" : "HostageUsed__11CBasePlayer"         }     ] }

Test plugin that I use:
Code:
#include < amxmodx > #include < orpheu > public plugin_init() {     OrpheuRegisterHook(OrpheuGetFunctionFromClass( "player", "HostageUse", "CBasePlayer" ),"OnHostageUse", OrpheuHookPre ) } public OrpheuHookReturn:OnHostageUse( id ) {     client_print( id, print_chat, "Used a hostage" ) }

What's wrong with the sign ?

baneado 08-18-2014 18:23

Re: Invalid Index Data
 
change the index to 0 on client_print and show the value of id using %d

maybe it isn't the player, you can know what parameter is viewing the HLSDK where you get the offset

hornet 08-18-2014 22:23

Re: Invalid Index Data
 
Quote:

Originally Posted by baneado (Post 2185976)
change the index to 0 on client_print and show the value of id using %d

It's unrelated. The function derives from CBasePlayer therefore that's what the first argument will be.


@HamEagle I can't say for sure what the error means, but I'm assuming there is other errors present? Your signature looks outdated but I doubt that is the cause. Also FYI function is CBasePlayer::HostageUsed().
Anyway, your trying to incorrectly use a virtual function. That function is specific to CBasePlayer. So don't use OrpheuGetFunctionFromClass() instead just OrpheuGetFunction(). A signature of bytes is used to locate the function in the memory, wheras virtual functions don't require signatures as they are accessed using an offset.

HamletEagle 08-19-2014 07:54

Re: Invalid Index Data
 
I just created my signature yesterday, with latest server build. I firstly used OrpheuGetFunction but it was saying that CBasePlayer::HostageUsed not found, so I decided to try with OrpheuGetFunctionFromClass( bad ideea ).

I redo it and now it's not giving any errors:

PHP Code:

{
    
"name" "HostageUsed",
    
"class" "CBasePlayer",
    
"library" "mod",
    
    
"identifiers"
    [ 
        { 
            
"os" "windows"
            
"mod" "cstrike"
            
"value" 34
        
}, 
        { 
            
"os" "linux"
            
"mod" "cstrike"
            
"value" "HostageUsed__11CBasePlayer"
        

    ] 


I still have to replace the sign for linux with the offset.

Thx for showing me the typo :)

Now, I have another problem. I added a message into the function, when I'm using a hostage, it doesn't print any message( Code in the first post ).

When I look in ida at the function header is shows void( nothing, if i'm right ), but when pressing F5 I see that the hearder has an int argument. How is this possibile ?


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

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