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

Block crouching and jumping?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 07-24-2010 , 12:12   Block crouching and jumping?
Reply With Quote #1

Question in the title ^.^

I've already tried blocking the buttons themselves, but it still gets through.
__________________
almcaeobtac is offline
KawMAN
SourceMod Donor
Join Date: Sep 2007
Location: Cracov
Old 07-24-2010 , 12:22   Re: Block crouching and jumping?
Reply With Quote #2

Try this:
PHP Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if(
buttons IN_JUMP)
    {
        
buttons &= ~IN_JUMP;
    }
    if(
buttons IN_DUCK)
    {
        
buttons &= ~IN_DUCK;
    }
    return 
Plugin_Continue;

__________________
KawMAN is offline
Send a message via ICQ to KawMAN Send a message via Skype™ to KawMAN
Monkeys
Veteran Member
Join Date: Jan 2010
Old 07-24-2010 , 13:53   Re: Block crouching and jumping?
Reply With Quote #3

I'm guessing that's what you meant by blocking the buttons?

The fact that it "gets through" is because of the prethinking.
The client expects to be able to crouch/jump, so it'll show the client as if he's jumping before the server's got time to respond.

Can't do much about that. Last topic about it got to a dead end.
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
thetwistedpanda
Good Little Panda
Join Date: Sep 2008
Old 07-24-2010 , 14:18   Re: Block crouching and jumping?
Reply With Quote #4

You could disable fall damage and set the client's gravity to an obscene amount, that would at least prevent jumping.
__________________
thetwistedpanda is offline
Greyscale
SourceMod Plugin Approver
Join Date: Dec 2007
Location: strYoMommasHouse[you];
Old 07-24-2010 , 14:27   Re: Block crouching and jumping?
Reply With Quote #5

Getting a bit ridiculous with this suggestion but it might be fun to try

Increase player gravity like the twistedpanda said, then turn down LaggedMovementValue to something that will counter-balance fall speed. LMV will slow a player down and their fall speed as well. Then to counter-balance that, use SDKHooks and PrePostThink to increase the player's speed.

Theoretically you will have a client that can't jump higher than a milimeter but everything else should be the same. If you wanna try this then say so and I'll give more info on using PrePostThink to set speed.
__________________
Greyscale is offline
almcaeobtac
Senior Member
Join Date: Nov 2008
Location: Florida
Old 07-24-2010 , 16:01   Re: Block crouching and jumping?
Reply With Quote #6

It's worth a shot

Also, what's the difference between the movetypes: MOVETYPE_ISOMETRIC and MOVETYPE_WALK?
__________________
almcaeobtac is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 07-24-2010 , 18:01   Re: Block crouching and jumping?
Reply With Quote #7

MOVETYPE_ISOMETRIC ignores all player speed formatting so players will move at sv_maxpeed or the cl_ speed limiting cvars whichever is lower.
blodia is offline
p3tsin
Senior Member
Join Date: Sep 2005
Location: Finland
Old 07-24-2010 , 18:10   Re: Block crouching and jumping?
Reply With Quote #8

Quote:
Originally Posted by thetwistedpanda View Post
You could disable fall damage and set the client's gravity to an obscene amount, that would at least prevent jumping.
m_flGravity isn't networked, so it will mess client predictions as well. If you really wanna alter the gravity, I'd suggest using it in combination with SendConVarValue and lie to the client that sv_gravity was changed to match his gravity.

Here's something from the source sdk in case you don't like that solution. Its probably not exactly the same as the one in whatever mod you're doing this for, but should be pretty close anyhow.

PHP Code:
bool CGameMovement::CheckJumpButtonvoid )
{
    if (
player->pl.deadflag)
    {
        
mv->m_nOldButtons |= IN_JUMP ;    // don't jump again until released
        
return false;
    }

    
// See if we are waterjumping.  If so, decrement count and return.
    
if (player->m_flWaterJumpTime)
    {
        
player->m_flWaterJumpTime -= gpGlobals->frametime;
        if (
player->m_flWaterJumpTime 0)
            
player->m_flWaterJumpTime 0;
        
        return 
false;
    }

    
// If we are in the water most of the way...
    
if ( player->GetWaterLevel() >= )
    {    
        
// swimming, not jumping
        
SetGroundEntity( (CBaseEntity *)NULL );

        if(
player->GetWaterType() == CONTENTS_WATER)    // We move up a certain amount
            
mv->m_vecVelocity[2] = 100;
        else if (
player->GetWaterType() == CONTENTS_SLIME)
            
mv->m_vecVelocity[2] = 80;
        
        
// play swiming sound
        
if ( player->m_flSwimSoundTime <= )
        {
            
// Don't play sound again for 1 second
            
player->m_flSwimSoundTime 1000;
            
PlaySwimSound();
        }

        return 
false;
    }

    
// No more effect
     
if (player->GetGroundEntity() == NULL)
    {
        
mv->m_nOldButtons |= IN_JUMP;
        return 
false;        // in air, so no effect
    
}

    
// Don't allow jumping when the player is in a stasis field.
#ifndef HL2_EPISODIC
    
if ( player->m_Local.m_bSlowMovement )
        return 
false;
#endif

    
if ( mv->m_nOldButtons IN_JUMP )
        return 
false;        // don't pogo stick

    // Cannot jump will in the unduck transition.
    
if ( player->m_Local.m_bDucking && (  player->GetFlags() & FL_DUCKING ) )
        return 
false;

    
// Still updating the eye position.
    
if ( player->m_Local.m_flDuckJumpTime 0.0f )
        return 
false;


    
// In the air now.
    
SetGroundEntity( (CBaseEntity *)NULL );
    
//irrelevant code omitted

There we have a bunch of conditions that are checked before a client is allowed to jump. Make sure one of them fails (on client side too) and you're good to go! I just tested setting deadflag to true and it worked very nicely, but I'm unsure if it has any side effects... feel free to experiment!
__________________
plop
p3tsin is offline
blodia
Veteran Member
Join Date: Sep 2009
Location: UK
Old 07-24-2010 , 18:31   Re: Block crouching and jumping?
Reply With Quote #9

its probably safer the make the game think the player is already in the air

PHP Code:
SetEntPropEnt(clientProp_Send"m_hGroundEntity", -1); 
blodia is offline
Kigen
BANNED
Join Date: Feb 2008
Old 07-26-2010 , 01:07   Re: Block crouching and jumping?
Reply With Quote #10

Quote:
Originally Posted by blodia View Post
its probably safer the make the game think the player is already in the air

PHP Code:
SetEntPropEnt(clientProp_Send"m_hGroundEntity", -1); 
That will probably have undesired side-effects because of the way velocity is processed in the Source engine.
Kigen 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 09:17.


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