Raised This Month: $344 Target: $400
 86%   Almost there!

Shift detection


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Grafi_
Junior Member
Join Date: Apr 2022
Location: Poland
Old 08-07-2022 , 10:47   Shift detection
Reply With Quote #1

Hi
Someone know how can i detect holding shift button?
Grafi_ is offline
alasfourom
Senior Member
Join Date: Feb 2022
Old 08-07-2022 , 12:17   Re: Shift detection
Reply With Quote #2

Is That What You Want?


PHP Code:
buttons IN_SPEED //SHIFT Button 
PHP Code:
bool buttondelay [MAXPLAYERS+1];

public 
Action OnPlayerRunCmd (int clientint &buttons)
{
    if (
buttons IN_SPEED && !buttondelay[client])
    {
        
buttondelay[client] = true;
        
CreateTimer(3.0Resetbuttondelayclient);
        
PrintToChat(client"You have pressed the <SHIFT> button");
    }
}

public 
Action Resetbuttondelay(Handle timerint client)
{
    
buttondelay[client] = false;

__________________
Now I Know: Peace

Last edited by alasfourom; 08-07-2022 at 12:28.
alasfourom is offline
Grafi_
Junior Member
Join Date: Apr 2022
Location: Poland
Old 08-07-2022 , 12:24   Re: Shift detection
Reply With Quote #3

Quote:
Originally Posted by alasfourom View Post
Is That What You Want?

PHP Code:
public Action OnPlayerRunCmd (int clientint &buttons)
{
    if (
buttons IN_SPEEDPrintToChat(client"You have pressed the <SHIFT> button");

yes, thank you
i was trying !(buttons & IN_SPEED) xD
Grafi_ is offline
alasfourom
Senior Member
Join Date: Feb 2022
Old 08-07-2022 , 12:31   Re: Shift detection
Reply With Quote #4

if you want to remove/block a button

PHP Code:
buttons &= ~IN_SPEED 
so should be like this I guess

PHP Code:
public Action OnPlayerRunCmd (int clientint &buttons)
{
    if (
buttons IN_SPEEDbuttons &= ~IN_SPEED 

__________________
Now I Know: Peace

Last edited by alasfourom; 08-07-2022 at 12:34.
alasfourom 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 03:32.


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