Raised This Month: $32 Target: $400
 8% 

how to make player move less sideways without slowhacking?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-08-2010 , 19:44   how to make player move less sideways without slowhacking?
Reply With Quote #1

Like cl_sidespeed, only without messing with clients variables.
__________________
Voi is offline
Arkshine
AMX Mod X Plugin Approver
Join Date: Oct 2005
Old 05-08-2010 , 20:01   Re: how to make player move less sideways without slowhacking?
Reply With Quote #2

Hook PM_Move, change sidespeed in the 'cmd' structure.
__________________
Arkshine is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-08-2010 , 20:37   Re: how to make player move less sideways without slowhacking?
Reply With Quote #3

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.
__________________
Voi is offline
Exolent[jNr]
Veteran Member
Join Date: Feb 2007
Location: Tennessee
Old 05-09-2010 , 01:44   Re: how to make player move less sideways without slowhacking?
Reply With Quote #4

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; }
__________________
No private work or selling mods.
Quote:
Originally Posted by xPaw View Post
I love you exolent!
Exolent[jNr] is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-09-2010 , 12:22   Re: how to make player move less sideways without slowhacking?
Reply With Quote #5

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 ?
__________________
Voi is offline
wrecked_
Veteran Member
Join Date: Jan 2010
Location: New York (GMT-5)
Old 05-09-2010 , 13:04   Re: how to make player move less sideways without slowhacking?
Reply With Quote #6

Quote:
Originally Posted by Voi View Post
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
__________________
[ Paid Requests ]
DO NOT PM ME ABOUT BLOCKMAKER
NO PRIVATE SUPPORT
wrecked_ is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-09-2010 , 13:15   Re: how to make player move less sideways without slowhacking?
Reply With Quote #7

Thanks.

How to retrieve the current sidespeed value ? Cause i propably want it floatclamped to lets say -150.0,150
__________________
Voi is offline
joaquimandrade
Veteran Member
Join Date: Dec 2008
Location: Portugal
Old 05-09-2010 , 13:16   Re: how to make player move less sideways without slowhacking?
Reply With Quote #8

Quote:
Originally Posted by Exolent[jNr] 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.
__________________

Last edited by joaquimandrade; 05-09-2010 at 13:23.
joaquimandrade is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-09-2010 , 13:27   Re: how to make player move less sideways without slowhacking?
Reply With Quote #9

@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 is offline
Voi
Veteran Member
Join Date: Sep 2006
Location: Gdansk, Poland
Old 05-20-2010 , 05:45   Re: how to make player move less sideways without slowhacking?
Reply With Quote #10

How do I retrieve current sidespeed value ?
__________________
Voi is offline
Reply


Thread Tools
Display Modes

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 23:17.


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