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

Swap buttons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nickelony
Junior Member
Join Date: Aug 2017
Location: Poland
Old 09-13-2017 , 11:25   Swap buttons
Reply With Quote #1

Hello.

I need something to swap IN_BACK with IN_FORWARDS in OnPlayerRunCmd, but I have no idea how to do it. Can somebody help me?

If it's not possible to do in OnPlayerRunCmd (which I doubt) then any other method will be appreciated as well.
Nickelony is offline
Papero
Veteran Member
Join Date: Aug 2016
Location: Italy
Old 09-13-2017 , 11:45   Re: Swap buttons
Reply With Quote #2

Check this: https://github.com/shanapu/MyJailbre...k.sp#L833-L873
__________________
My Plugins
SPCode


Steam: hexer504
Telegram: Hexah
Discord: Hexah#6903

If you like my work you can donate here!
Papero is offline
Vasto_Lorde
Junior Member
Join Date: Oct 2016
Old 09-13-2017 , 19:23   Re: Swap buttons
Reply With Quote #3

This might help (code from PropHunt by Statistician)

Code:
stock void PreventCTFire(int client, int &buttons) {
    if (GetClientTeam(client) != CS_TEAM_CT)
        return;

    char weaponName[30];

    GetClientWeapon(client, weaponName, sizeof(weaponName));
    if (g_bIsCTWaiting[client] && (buttons & IN_ATTACK || buttons & IN_ATTACK2)) {
        // dont allow shooting in the beginning of the round
        buttons &= ~IN_ATTACK;
        buttons &= ~IN_ATTACK2;
    } else if (buttons & IN_ATTACK2 && StrEqual(weaponName, "weapon_knife")) {

        // disable rightclick knifing
        buttons &= ~IN_ATTACK2;
    }
}
Its being called inside OnPlayerRunCmd
Vasto_Lorde is offline
hmmmmm
Great Tester of Whatever
Join Date: Mar 2017
Location: ...
Old 09-14-2017 , 07:57   Re: Swap buttons
Reply With Quote #4

If you literally just want to swap the input buttons you can do something like this:
PHP Code:
public Action OnPlayerRunCmdint clientintbuttons )
{
    if( 
buttons IN_BACK )
    {
        
buttons &= ~IN_BACK;
        
buttons |= IN_FORWARD;
    }
    else if( 
buttons IN_FORWARD )
    {
        
buttons &= ~IN_FORWARD;
        
buttons |= IN_BACK;
    }

If you're going for effect where pressing forward moves you backwards and vice versa you might be better off changing their velocity.
EDIT: What Papero linked does both, so I would go with that

Last edited by hmmmmm; 09-14-2017 at 07:58.
hmmmmm 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 19:55.


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