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

[ H3LP ] Block IN_BACK


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-21-2018 , 16:37   [ H3LP ] Block IN_BACK
Reply With Quote #1

Hello, I'm trying to block the velocity that is applied when player press IN_BACK. I tried the following but doesn't work properly.

Code:
public CBasePlayer_PreThink(this) {     if (!is_user_alive(this))         return HC_CONTINUE;     static bitsButton;     bitsButton = get_entvar(this, var_button);     if (bitsButton & IN_BACK)         set_entvar(this, var_button, bitsButton & ~IN_BACK);     return HC_CONTINUE; }

Also I tried to disable maxspeed, but doesn't worked.

Code:
public CBasePlayer_ResetMaxSpeed_Post(this) {     if (!is_user_alive(this))         return;     set_entvar(this, var_maxspeed, 0.0); }
__________________








CrazY. is offline
Natsheh
Veteran Member
Join Date: Sep 2012
Old 06-22-2018 , 03:41   Re: [ H3LP ] Block IN_BACK
Reply With Quote #2

You can do this, get user velocity, strip backward velocity, then set his velocity.
__________________
@Jailbreak Main Mod v2.7.0 100%
@User Tag Prefix 100% done !
@Mystery Box 100% done !
@VIP System 100% done !


Last edited by Natsheh; 06-22-2018 at 03:58.
Natsheh is offline
Send a message via MSN to Natsheh Send a message via Skype™ to Natsheh
Kushfield
Member
Join Date: Jan 2017
Location: Estonia
Old 06-22-2018 , 09:38   Re: [ H3LP ] Block IN_BACK
Reply With Quote #3

Quote:
Originally Posted by Natsheh View Post
You can do this, get user velocity, strip backward velocity, then set his velocity.
You can have backwards velocity without using IN_BACK as well, I think the goal here is to block just IN_BACK.

I've been looking for a way to do this as well, and finally ended up with this:
PHP Code:
public fwdRG_PM_Move()
{
    new 
ucmd get_pmove(pm_cmd);
    new 
Float:fwmove get_ucmd(ucmducmd_forwardmove);
    if(
fwmove 0)
    {
        
set_ucmd(ucmducmd_forwardmove0.0);
        
//set_ucmd(ucmd, ucmd_buttons, get_ucmd(ucmd, ucmd_buttons) & ~IN_BACK);
    
}

Blocking movement this way is somewhat laggy for the client though, since it starts moving instantly and then gets reset after the command reaches the server.

Last edited by Kushfield; 06-22-2018 at 09:38.
Kushfield is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-22-2018 , 09:41   Re: [ H3LP ] Block IN_BACK
Reply With Quote #4

Ok, thanks anyway, but I think be better doesn't use this way. The real problem is when I try to set velocity to "down", is applied a little velocity to backward too, then the player moves diagonally.
__________________









Last edited by CrazY.; 06-22-2018 at 09:43.
CrazY. is offline
PurposeLessx
Senior Member
Join Date: Jun 2017
Old 06-22-2018 , 10:21   Re: [ H3LP ] Block IN_BACK
Reply With Quote #5

Try this. It may works.

rg_reset_maxspeed(id)
PurposeLessx is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 06-22-2018 , 11:44   Re: [ H3LP ] Block IN_BACK
Reply With Quote #6

I tried this in the second way.
__________________








CrazY. is offline
raizo11
BANNED
Join Date: Dec 2013
Location: https://t.me/pump_upp
Old 06-23-2018 , 19:56   Re: [ H3LP ] Block IN_BACK
Reply With Quote #7

Code:
register_forward(FM_UpdateClientData, "Data", 1)

public Data(id, weapons, cd)
{
        set_cd(cd, CD_flNextAttack, 1.0)
          
        if((entity_get_int(id, EV_INT_button) & (IN_BACK )))
            set_cd(cd, CD_MaxSpeed, 1.0)
}

Last edited by raizo11; 06-23-2018 at 19:58.
raizo11 is offline
Send a message via ICQ to raizo11 Send a message via AIM to raizo11 Send a message via MSN to raizo11 Send a message via Yahoo to raizo11 Send a message via Skype™ to raizo11
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 11:40.


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