AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   how to make player move less sideways without slowhacking? (https://forums.alliedmods.net/showthread.php?t=126380)

Voi 05-08-2010 19:44

how to make player move less sideways without slowhacking?
 
Like cl_sidespeed, only without messing with clients variables.

Arkshine 05-08-2010 20:01

Re: how to make player move less sideways without slowhacking?
 
Hook PM_Move, change sidespeed in the 'cmd' structure.

Voi 05-08-2010 20:37

Re: how to make player move less sideways without slowhacking?
 
Well im not that advanced in amxx coding ^^. As far as I understand I need to hook it via orpheu. Since this is currently black magic for me, you must explain it with sufficient amount of code to help me.

Exolent[jNr] 05-09-2010 01:44

Re: how to make player move less sideways without slowhacking?
 
Code:
#include < amxmodx > #include < orpheu > #include < orpheu_advanced > #include < orpheu_memory > public plugin_init( ) {     OrpheuRegisterHook( OrpheuGetFunction( "PM_Move" ), "PM_Move" ); } public OrpheuHookReturn:PM_Move( ) {     new OrpheuStruct:ppmove = OrpheuGetStructFromAddress( OrpheuStructPlayerMove, OrpheuMemoryGet( "ppmove" ) );         new iPlayer = OrpheuGetStructMember( ppmove, "player_index" ) + 1;         if( is_user_alive( iPlayer ) )     {         new OrpheuStruct:cmd = OrpheuStruct:OrpheuGetStructMember( ppmove, "cmd" );                 // change 0.0 to your value         OrpheuSetStructMember( cmd, "sidemove", 0.0 );     }         return OrpheuIgnored; }

Voi 05-09-2010 12:22

Re: how to make player move less sideways without slowhacking?
 
Quote:

L 05/09/2010 - 18:19:10: [ORPHEU] Function "PM_Move" not found
I guess i miss something. I've got installed orpheu_base.zip from here:
http://forums.alliedmods.net/showthread.php?t=116393
Anything else I need ?

wrecked_ 05-09-2010 13:04

Re: how to make player move less sideways without slowhacking?
 
Quote:

Originally Posted by Voi (Post 1175603)
I guess i miss something. I've got installed orpheu_base.zip from here:
http://forums.alliedmods.net/showthread.php?t=116393
Anything else I need ?

http://forums.alliedmods.net/showthread.php?t=118476

Voi 05-09-2010 13:15

Re: how to make player move less sideways without slowhacking?
 
Thanks.

How to retrieve the current sidespeed value ? Cause i propably want it floatclamped to lets say -150.0,150

joaquimandrade 05-09-2010 13:16

Re: how to make player move less sideways without slowhacking?
 
Quote:

Originally Posted by Exolent[jNr] (Post 1175155)

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.

Voi 05-09-2010 13:27

Re: how to make player move less sideways without slowhacking?
 
@joaquimandrade
Thanks, it works. But how do i first get the sidespeed value so i could floatclamp it?
Setting the speed like it is now just forces player to move left or right.

Voi 05-20-2010 05:45

Re: how to make player move less sideways without slowhacking?
 
How do I retrieve current sidespeed value ?


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

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