Raised This Month: $51 Target: $400
 12% 

force player to use PM_AirMove for movement


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 01-29-2014 , 10:36   force player to use PM_AirMove for movement
Reply With Quote #1

this is what i have tried:
Code:
public plugin_init() {     OrpheuRegisterHook(OrpheuGetFunction( "PM_Move" ), "PM_Move") } public OrpheuHookReturn:PM_Move(OrpheuStruct:ppmove,server) {     new id = OrpheuGetStructMember(ppmove, "player_index") + 1     if( is_user_alive(id)) {         OrpheuSetStructMember(ppmove, "onground", -1);     }     return OrpheuIgnored }

it doesn't seem to work, player still moves with PM_WalkMove and when i check flags for FL_ONGROUND in player postthink, its set.
I didn't find anything that changes onground from PM_Move -> PM_PlayerMove -> PM_AirMove

edit: maybe it would be better to block PM_WalkMove and call PM_AirMove instead of that? never used orpheu before so help is appreciated


edit2: little progress
Code:
public plugin_init() {     register_plugin(PLUGIN, VERSION, AUTHOR)     OrpheuRegisterHook( OrpheuGetFunction( "PM_WalkMove" ), "PM_WalkMove" )     OrpheuRegisterHook(OrpheuGetFunction( "PM_Move" ), "PM_Move")     PM_AirMove = OrpheuGetFunction("PM_AirMove") } public OrpheuHookReturn:PM_WalkMove() {     OrpheuCall(PM_AirMove)     return OrpheuSupercede } public OrpheuHookReturn:PM_Move(OrpheuStruct:ppmove,server) {     new id = OrpheuGetStructMember(ppmove, "player_index") + 1     if( is_user_alive(id)) {         OrpheuSetStructMember(ppmove, "onground", -1);         OrpheuSetStructMember(ppmove, "friction", 0.1);     }     return OrpheuIgnored }

this kind of works, you gain speed by strafing, just like in air, but the max speed seems to be similar to users maxspeed. the "friction" value 0.1 is totally random, i tried several values and this seemed to have the biggest effect. also server crashed every now and then when i connected, pretty sure this causes it to happen

Last edited by jimaway; 01-29-2014 at 14:10.
jimaway is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 01-29-2014 , 20:31   Re: force player to use PM_AirMove for movement
Reply With Quote #2

First code won't work because pmove->onground will be overriden on PM_CatagorizePosition which is called on PM_PlayerMove, inside PM_Move.

Something you can do is hook PM_Friction which is called just before PM_AirMove/WalkMove, block it, and set new onground value, but you'll maybe see an issue with your velocity because at the moment you hook PM_Friction, just before that, velocity[2] is set to 0.0.
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 01-30-2014 , 07:09   Re: force player to use PM_AirMove for movement
Reply With Quote #3

thanks for the help, this seems to work fine:
Code:
#include <amxmodx> #include <orpheu> #include <orpheu_advanced> #include <orpheu_memory> public plugin_init() {     OrpheuRegisterHook(OrpheuGetFunction("PM_CatagorizePosition"), "PM_CatagorizePosition", OrpheuHookPost)  } public OrpheuHookReturn:PM_CatagorizePosition() {     new OrpheuStruct:ppmove = OrpheuGetStructFromAddress(OrpheuStructPlayerMove,OrpheuMemoryGet("ppmove"))     OrpheuSetStructMember(ppmove, "onground", -1) }
jimaway is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 02-07-2014 , 18:11   Re: force player to use PM_AirMove for movement
Reply With Quote #4

can anyone make me updated orpheu signature for PM_CatagorizePosition

this is the old one, if it helps at all
Code:
{
	"name" : "PM_CatagorizePosition",
	"library" : "mod",
	"identifiers" :
	[
		{
			"os" : "windows",
			"mod" : "cstrike",
			"value" : [0x83,0xEC,0x50,0x55,0x56,0x57,0xE8,0x35,0xFE,0xFF,0xFF,0x8B,0x0D,"*","*","*","*",0x8B,0x41,0x38,0x8D]
		},
		{
			"os" : "linux",
			"mod" : "cstrike",
			"value" : "PM_CatagorizePosition"
		}
	]
}
jimaway is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 02-08-2014 , 18:53   Re: force player to use PM_AirMove for movement
Reply With Quote #5

managed to make it myself
Code:
{
	"name" : "PM_CatagorizePosition",
	"library" : "mod",
	"identifiers" :
	[
		{
			"os" : "windows",
			"mod" : "cstrike",
			"value" : 0xB33A0
		},
		{
			"os" : "linux",
			"mod" : "cstrike",
			"value" : "PM_CatagorizePosition"
		}
	]
}
jimaway is offline
jimaway
Heeeere's Jimmy!
Join Date: Jan 2009
Location: Estonia
Old 02-11-2014 , 10:52   Re: force player to use PM_AirMove for movement
Reply With Quote #6

ok now this thing: when i run this on listen server i get step sounds played every frame however this does not happen on a dedicated server.
According to pm_shared.c in hlsdk this should not happen

Code:
void PM_PlayerMove ( qboolean server )
{
	stuff...

	// Now that we are "unstuck", see where we are ( waterlevel and type, pmove->onground ).
	PM_CatagorizePosition();

	// Store off the starting water level
	pmove->oldwaterlevel = pmove->waterlevel;

	// If we are not on ground, store off how fast we are moving down
	if ( pmove->onground == -1 )
	{
		pmove->flFallVelocity = -pmove->velocity[2];
	}

	g_onladder = 0;
	// Don't run ladder code if dead or on a train
	if ( !pmove->dead && !(pmove->flags & FL_ONTRAIN) )
	{
		pLadder = PM_Ladder();
		if ( pLadder )
		{
			g_onladder = 1;
		}
	}

	PM_UpdateStepSound();
Code:
void PM_UpdateStepSound( void )
{
	stuff...

	// If we're on a ladder or on the ground, and we're moving fast enough,
	//  play step sound.  Also, if pmove->flTimeStepSound is zero, get the new
	//  sound right away - we just started moving in new level.
	if ( (fLadder || ( pmove->onground != -1 ) ) &&
		( Length( pmove->velocity ) > 0.0 ) &&
		( speed >= velwalk || !pmove->flTimeStepSound ) )
	{
		stuff...

		PM_PlayStepSound( step, fvol );
	}
}
as you can see PM_CatagorizePosition() is called before PM_UpdateStepSound(), meaning onground should be -1 in PM_UpdateStepSound() and PM_PlayStepSound() should never be called

any ideas on whats causing this?

Last edited by jimaway; 02-11-2014 at 10:56.
jimaway is offline
meTaLiCroSS
Gaze Upon My Hat
Join Date: Feb 2009
Location: Viņa del Mar, Chile
Old 02-11-2014 , 17:00   Re: force player to use PM_AirMove for movement
Reply With Quote #7

Quote:
Originally Posted by jimaway View Post
ok now this thing: when i run this on listen server i get step sounds played every frame however this does not happen on a dedicated server.
According to pm_shared.c in hlsdk this should not happen

Code:
void PM_PlayerMove ( qboolean server )
{
	stuff...

	// Now that we are "unstuck", see where we are ( waterlevel and type, pmove->onground ).
	PM_CatagorizePosition();

	// Store off the starting water level
	pmove->oldwaterlevel = pmove->waterlevel;

	// If we are not on ground, store off how fast we are moving down
	if ( pmove->onground == -1 )
	{
		pmove->flFallVelocity = -pmove->velocity[2];
	}

	g_onladder = 0;
	// Don't run ladder code if dead or on a train
	if ( !pmove->dead && !(pmove->flags & FL_ONTRAIN) )
	{
		pLadder = PM_Ladder();
		if ( pLadder )
		{
			g_onladder = 1;
		}
	}

	PM_UpdateStepSound();
Code:
void PM_UpdateStepSound( void )
{
	stuff...

	// If we're on a ladder or on the ground, and we're moving fast enough,
	//  play step sound.  Also, if pmove->flTimeStepSound is zero, get the new
	//  sound right away - we just started moving in new level.
	if ( (fLadder || ( pmove->onground != -1 ) ) &&
		( Length( pmove->velocity ) > 0.0 ) &&
		( speed >= velwalk || !pmove->flTimeStepSound ) )
	{
		stuff...

		PM_PlayStepSound( step, fvol );
	}
}
as you can see PM_CatagorizePosition() is called before PM_UpdateStepSound(), meaning onground should be -1 in PM_UpdateStepSound() and PM_PlayStepSound() should never be called

any ideas on whats causing this?
Quote:
Originally Posted by joaquimandrade
On a last note, PM functions occur in parallel in the server and the client and because of client prediction there are functions that are useless to block since they will occur in the client anyway or at least don't act exactly as expected.
Same code is executed on both client and server, hope this let you know that you can't block or change anything
__________________
Quote:
Originally Posted by joropito View Post
You're right Metalicross
meTaLiCroSS 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 17:46.


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