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

Respawn player when stuck (PM_CheckVelocity Orpheu)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
marcelowzd
Senior Member
Join Date: Feb 2011
Location: São Paulo, Brazil
Old 10-24-2018 , 18:27   Respawn player when stuck (PM_CheckVelocity Orpheu)
Reply With Quote #1

Hello AlliedModders

Sometimes when you have Auto BunnyHop installed in your server and a player gets stuck in func_rotating (or some other entities)
the console gets spammed with the following message and finally it crashes.

Code:
PM  Got a NaN velocity 1
PM  Got a NaN velocity 0
I saw this in HLSDK.
PHP Code:
extern    int nanmask;

#define    IS_NAN(x) (((*(int *)&x)&nanmask)==nanmask)

void PM_CheckVelocity ()
{
    
int        i;

    for (
i=i<i++)
    {
        
// See if it's bogus.
        
if (IS_NAN(pmove->velocity[i]))
        {
            
pmove->Con_Printf ("PM  Got a NaN velocity %i\n"i);
            
pmove->velocity[i] = 0;
        }
        if (
IS_NAN(pmove->origin[i]))
        {
            
pmove->Con_Printf ("PM  Got a NaN origin on %i\n"i);
            
pmove->origin[i] = 0;
        }

        
// Bound it.
        
if (pmove->velocity[i] > pmove->movevars->maxvelocity
        {
            
pmove->Con_DPrintf ("PM  Got a velocity too high on %i\n"i);
            
pmove->velocity[i] = pmove->movevars->maxvelocity;
        }
        else if (
pmove->velocity[i] < -pmove->movevars->maxvelocity)
        {
            
pmove->Con_DPrintf ("PM  Got a velocity too low on %i\n"i);
            
pmove->velocity[i] = -pmove->movevars->maxvelocity;
        }
    }

What i wanted to do is catch this event with Orpheu and respawn the player if velocity is NaN.
The problem is that i don't understand orpheu neither that #define, that's why i'm posting
this as a request and not in scripting section.

I tried the following code from metalicross (found in alliedmodders) and also some that i wrote to test,
but the function never got called. I'm also posting the files (i don't know if they are correct, i used the ones
joaquimandrades posted but they are old)

PHP Code:
#include < amxmodx >
#include < fakemeta >
#include < orpheu >
#include < orpheu_stocks >
#include < orpheu_memory >
#include < orpheu_advanced >

new OrpheuStruct:g_pPMove;

public 
plugin_init( )
{
    
OrpheuRegisterHookOrpheuGetDLLFunction"pfnPM_Move""PM_Move" ), "PM_Move" );
    
OrpheuRegisterHookOrpheuGetFunction"PM_CheckVelocity" ), "PM_CheckVelocity" );

    
//OrpheuRegisterHook( OrpheuGetFunction( "PM_CheckVelocity" ), "PM_CheckVelocity" );
}

public 
PM_MoveOrpheuStruct:ppmoveserver )
{
    
g_pPMove ppmove;

    
console_print0"PM MOVE" );
}

public 
PM_CheckVelocity( )
{
    
//new OrpheuStruct:ppmove = OrpheuGetStructFromAddress( OrpheuStructPlayerMove, OrpheuMemoryGet( "ppmove" ) );

    
new iPlayer OrpheuGetStructMemberg_pPMove"player_index" ) + 1;

    
//new iPlayer = OrpheuGetStructMember( ppmove, "player_index" ) + 1;

    
console_printiPlayer"PM CHECK VELOCITY" );
}

/*public OrpheuHookReturn:PM_CheckVelocity( )
{
    new OrpheuStruct:ppmove = OrpheuGetStructFromAddress( OrpheuStructPlayerMove, OrpheuMemoryGet( "ppmove" ) );

    //new iPlayer = OrpheuGetStructMember( ppmove, "player_index" ) + 1;

    console_print( iPlayer, "PM CHECK VELOCITY" );
}*/ 
Code:
{
	"name" : "PM_Move",
	"library" : "mod",
	"arguments" :
	[
		{
			"type" : "playermove_s *"
		},
		{
			"type" : "qboolean"
		}
	],
	"identifiers" :
	[
		{
			"os" : "windows",
			"mod" : "cstrike",
			"value" : 0xbffc0
		},
		{
			"os" : "linux",
			"mod" : "cstrike",
			"value" : "PM_Move"
		}
	]
}
Code:
{
	"name" : "PM_CheckVelocity",
	"library" : "mod",
	"identifiers" :
	[
		{
			"os" : "windows",
			"mod" : "cstrike",
			"value" : 0xBB5E0
		},
		{
			"os" : "linux",
			"mod" : "cstrike",
			"value" : "PM_CheckVelocity"
		}
	]
}
Thanks in advance.
__________________

Last edited by marcelowzd; 10-25-2018 at 08:09.
marcelowzd 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 02:14.


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