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

Force client to jump


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
malkins
Junior Member
Join Date: Jan 2022
Old 01-10-2022 , 19:55   Force client to jump
Reply With Quote #1

I am trying to make a ZombiePanicSource bot (fakeclient) jump and it has to be done via SetEntProp, I am running this command in PreThink and nothing happens but if I swap it for IN_ATTACK the bot does its melee attack as expected, same happens on the human player as well.

SetEntProp(client, Prop_Data, "m_nButtons", IN_JUMP);

Any ideas how to get this to work?
malkins is offline
boink
Member
Join Date: May 2021
Location: Australia
Old 01-11-2022 , 00:13   Re: Force client to jump
Reply With Quote #2

Might not work for your situation, but one alternative hacky method I came across was to fake the jump entirely, and manually set their velocity to mimic a jump on a repeat timer. It's not flawless but I couldn't figure out how to get the IN_JUMP buttons working either.

https://github.com/b0ink/csgo-chaos-mod/blob/main/scripting/Effects.sp

Last edited by boink; 03-09-2022 at 08:17.
boink is offline
malkins
Junior Member
Join Date: Jan 2022
Old 01-12-2022 , 06:57   Re: Force client to jump
Reply With Quote #3

Quote:
Originally Posted by boink View Post
Might not work for your situation, but one alternative hacky method I came across was to fake the jump entirely, and manually set their velocity to mimic a jump on a repeat timer. It's not flawless but I couldn't figure out how to get the IN_JUMP buttons working either.

https://github.com/b0ink/csgo-chaos-...s.sp#L559-L580
Unfortunately this causes the player/bot to jump higher than a normal jump and if I set the upward velocity bellow 250, nothing happens.

I guess it's better than nothing for now, thanks for replying.

I also looked at SourceSDK and I don't get why IN_JUMP isn't working, the code seems very similar to IN_ATTACK, perhaps I need to call SDK's CheckJumpKey() before/after setting IN_JUMP, I'll give that a go and report back if it works.
malkins is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 01-12-2022 , 07:11   Re: Force client to jump
Reply With Quote #4

Should work if you set it in OnPlayerRunCmd
xerox8521 is offline
malkins
Junior Member
Join Date: Jan 2022
Old 01-12-2022 , 07:36   Re: Force client to jump
Reply With Quote #5

Quote:
Originally Posted by xerox8521 View Post
Should work if you set it in OnPlayerRunCmd
It's for fakeclients (bots).
malkins is offline
xerox8521
Senior Member
Join Date: Sep 2011
Old 01-12-2022 , 07:58   Re: Force client to jump
Reply With Quote #6

They still should trigger OnPlayerRunCmd. Bots in source engine games usually inherit from the player class or are otherwise connected to the player class.

Last edited by xerox8521; 01-12-2022 at 07:58.
xerox8521 is offline
malkins
Junior Member
Join Date: Jan 2022
Old 01-12-2022 , 18:32   Re: Force client to jump
Reply With Quote #7

Quote:
Originally Posted by xerox8521 View Post
They still should trigger OnPlayerRunCmd. Bots in source engine games usually inherit from the player class or are otherwise connected to the player class.
Now I feel dumb, should have tried OnPlayerRunCmd long ago, it works!

I figured since it had Player in the name it wouldn't work

Code:

Code:
float jumpTime = 0;
public Action:OnPlayerRunCmd(int client, int &buttons, int &impulse, float vel[3], float angles[3], int &weapon, int &subtype, int &cmdnum, int &tickcount, int &seed, int mouse[2])
{
    if( IsFakeClient(client) )
    {
        // jump every 3 seconds
        if(GetGameTime() > jumpTime + 3.0)
        {
            buttons |= IN_JUMP;
            jumpTime = GetGameTime();
        }
    }
    

    return Plugin_Continue;
}

Last edited by malkins; 01-12-2022 at 20:46.
malkins 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 01:10.


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