Raised This Month: $ Target: $400
 0% 

Solved Orpheu natives


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
edon1337
Penguin Enthusiast
Join Date: Jun 2016
Location: Macedonia
Old 07-15-2018 , 09:24   Re: Orpheu natives
Reply With Quote #1

Quote:
Originally Posted by HamletEagle View Post
No, it passes the parameters that are listed in the orpheu file.
OrpheuGetParamStructMember is to be used with structures, not needed in this case.

For DropPlayerItem the function is:
PHP Code:
CBasePlayer::DropPlayerItem(const char *pszItemName
Meaning that the function gets a parameter that is a char array, which in pawn translates to ItemName[MAX_DIM].
But that's not the only parameter. Functions that are member of a class pass the object as the first parameter("this") which in a plugin translates to the entity index. In your case it would be the player index since DropPlayerItem is member of CBasePlayer class.

The correct header would be:
PHP Code:
public @DropPlayerItem(idItemName[32]). 
The OrpheuGetFunction would look like this:
PHP Code:
new OrpheuFunction:DropPlayerItem OrpheuGetFunction("DropPlayerItem""CBasePlayer"); 
And the signature would be:
PHP Code:
{
    
"name" "DropPlayerItem",
    
"class" "CBasePlayer",
    
"library" "mod",
    
"arguments" :
    [
        {
            
"type" "char *"
        
}
    ],
    
"identifiers" :
    [
        {
            
"os" "windows",
            
"mod" "cstrike",
            
"value" : [0x83,"*","*",0x33,"*",0x53,0x55,0x56,0x8b,"*","*","*",0x57,0x8B,"*",0x8B]
        },
        {
            
"os" "linux",
            
"mod" "cstrike",
            
"value" "_ZN11CBasePlayer14DropPlayerItemEPKc"
        
}
    ]

Notice the arguments part, you don't need to specify the object(the entity index), we only mention the ItemName argument.

But I see you are trying to hook Spawn. What spawn are you trying to hook? For what entity?
Thanks for the explanation, I accidentally used @DropPlayerItem as the handler name, because I was dealing with it before, I was hooking CBasePlayer::Spawn.

So why is the parameter not specified here? I do know now that in class functions the first parameter is the entity index, in my case the player.

https://github.com/s1lentq/ReGameDLL.../player.h#L329

This is pretty much the code to hook player spawn with Orpheu, if I'm not mistaken?
PHP Code:
#include < amxmodx >
#include < orpheu >

public plugin_init( )
{
    
register_plugin"Orpheu Example""1.0""DoNii" );

    new 
OrpheuFunction:Spawn OrpheuGetFunction"Spawn" );
    
OrpheuRegisterHookSpawn"@Spawn" );
}

public @
Spawnid )
{
    
client_printidprint_chat"You just spawned!" );

__________________
edon1337 is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


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


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