View Single Post
Seta00
The Seta00 user has crashed.
Join Date: Jan 2010
Location: Berlin
Old 05-20-2010 , 08:40   Re: Orpheu: Engine PM Functions
Reply With Quote #26

Quote:
Originally Posted by joaquimandrade View Post
PM_Move receives ppmove as argument and it's a DLL function so it's safer to use it as such.

PHP Code:
#include < amxmodx >
#include < orpheu >
#include < orpheu_stocks >

public plugin_init( )
{
    
OrpheuRegisterHookOrpheuGetDLLFunction"pfnPM_Move","PM_Move" ), "PM_Move" );
}

public 
OrpheuHookReturn:PM_Move(OrpheuStruct:ppmove,server)
{    
    new 
iPlayer OrpheuGetStructMemberppmove"player_index" ) + 1;
    
    if( 
is_user_aliveiPlayer ) )
    {
        new 
OrpheuStruct:cmd OrpheuStruct:OrpheuGetStructMemberppmove"cmd" );
        
        
// change 0.0 to your value
        
OrpheuSetStructMembercmd"sidemove"0.0 );
    }
    
    return 
OrpheuIgnored;

Put this in a file called PM_Move in configs/orpheu/functions

HTML Code:
{
    "name" : "PM_Move",
    "library" : "mod",
    "arguments" :
    [
        {
            "type" : "playermove_s *"
        },
        {
            "type" : "qboolean"
        }
    ]
}
By the way. Getting ppmove like that (for other functions) is not that safe (i have to change that in the tutorial). The best thing probably is hooking always PM_Move like this + storing ppmove in a global var.

Edit: by safe I mean "update proof" but in this case, doing like I said in my last sentence, is also mod independent so I recommend it.
I'll leave this here.
Seta00 is offline