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

[ANY?] Button Detector


Post New Thread Reply   
 
Thread Tools Display Modes
Author
xfusionlockx
AlliedModders Donor
Join Date: Aug 2014
Plugin ID:
5775
Plugin Version:
1.0.0
Plugin Category:
Technical/Development
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
     
    Plugin Description:
    This is a super simple plugin that detects button presses and releases.
    Old 08-22-2017 , 00:08   [ANY?] Button Detector
    Reply With Quote #1

    Button Detector
    Version: 1.0.0 | Made by: FusionLock - Fusion Developments

    Description:
    Quote:
    This is a super simple plugin that detects button presses and releases. This is based on a code snippet released by "psychonic" (Thread by psychonic)
    This plugin has two forwards, OnButtonPressed and OnButtonReleased, you use them like any other forward you would.

    Examples:
    Code:
    public void OnButtonPressed(int iClient, int iButton)
    {
         PrintToChat(iClient, "You pressed %i", iButton);
    }
    Code:
    public void OnButtonReleased(int iClient, int iButton)
    {
         PrintToChat(iClient, "You released %i", iButton);
    }
    Button List


    Usage:
    Quote:
    To use this in your plugin make sure buttondetector.smx is running and add this include to your plugin and use the forwards like normal.
    Code:
    #include <buttondetector>
    Browse The Source Code
    Download The Plugin

    Attached Files
    File Type: zip button-detector_v1.0.0.zip (7.8 KB, 199 views)

    Last edited by xfusionlockx; 09-10-2017 at 16:27. Reason: Moved plugin repository to GitHub.
    xfusionlockx is offline
    xfusionlockx
    AlliedModders Donor
    Join Date: Aug 2014
    Old 08-22-2017 , 00:55   Re: [ANY?] Button Detector
    Reply With Quote #2

    Update! Oddly enough the button detection doesn't use the list found in entity_prop_stocks.inc so I had to write up my own.

    PHP Code:
    #define ATTACK        1
    #define JUMP         2
    #define DUCK         4
    #define FORWARD        8
    #define BACK        16
    #define USE            32
    #define CANCEL        64
    #define LEFT         128
    #define RIGHT        256
    #define MOVELEFT     512
    #define MOVERIGHT     1024
    #define ATTACK2        2048
    #define RUN            4096
    #define RELOAD        8192
    #define ALT1        16384
    #define ALT2        32768
    #define SCORE        65536
    #define SPEED        131072
    #define WALK        262144
    #define ZOOM        524288
    #define WEAPON1        1048576
    #define WEPAON2        2097152
    #define BULLRUSH     4194304
    #define GRENADE1     8388608
    #define GRENADE2     16777216
    #define ATTACK3        33554432 
    The update has already been pushed to the repository.

    EDIT: Added the latest plugin version to the thread.

    Last edited by xfusionlockx; 08-22-2017 at 00:59. Reason: Added latest plugin version to thread
    xfusionlockx is offline
    ThatKidWhoGames
    Veteran Member
    Join Date: Jun 2013
    Location: IsValidClient()
    Old 08-22-2017 , 17:10   Re: [ANY?] Button Detector
    Reply With Quote #3

    Thanks for this!!
    ThatKidWhoGames is offline
    xfusionlockx
    AlliedModders Donor
    Join Date: Aug 2014
    Old 08-23-2017 , 01:09   Re: [ANY?] Button Detector
    Reply With Quote #4

    Quote:
    Originally Posted by ThatKidWhoGames View Post
    Thanks for this!!
    You're welcome man.
    xfusionlockx is offline
    AK978
    Senior Member
    Join Date: Jun 2018
    Old 02-25-2019 , 20:29   Re: [ANY?] Button Detector
    Reply With Quote #5

    Useful for l4d2

    Can make binding buttons
    very convenient

    Last edited by AK978; 02-25-2019 at 20:33.
    AK978 is offline
    xfusionlockx
    AlliedModders Donor
    Join Date: Aug 2014
    Old 04-17-2019 , 19:25   Re: [ANY?] Button Detector
    Reply With Quote #6

    Quote:
    Originally Posted by AK978 View Post
    public Action OnPlayerRunCmd(int iClient, int &iButtons, int &iImpulse, float fVel[3], float fAngles[3], int &iWeapon, int &iSubtype, int &iCmdnum, int &iTickcount, int &iSeed, int iMouse[2])
    {
    PrintToChat(iClient, "%i", iButtons);
    }

    My keyboard doesn't have any action but prints 0,0 What does it mean?
    Code:
    public void OnButtonPressed(int iClient, int iButton)
    {
         PrintToChat(iClient, "You pressed %i", iButton);
    }
    Code:
    public void OnButtonReleased(int iClient, int iButton)
    {
         PrintToChat(iClient, "You released %i", iButton);
    }
    You use those forwards with my plugin.
    xfusionlockx is offline
    AK978
    Senior Member
    Join Date: Jun 2018
    Old 04-17-2019 , 21:09   Re: [ANY?] Button Detector
    Reply With Quote #7

    Wrong question, ignore it.
    AK978 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:04.


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