Raised This Month: $ Target: $400
 0% 

How to check player hold right mouse then release


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
snack_koo
Junior Member
Join Date: Jan 2012
Old 11-16-2014 , 10:40   How to check player hold right mouse then release
Reply With Quote #1

I want to make a function for weapon Katana
when player do right mouse click and hold that button, katana play an animation, when player release right mouse button katana play another animation and do damage to victim
How do I check?
snack_koo is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-16-2014 , 13:30   Re: How to check player hold right mouse then release
Reply With Quote #2

PHP Code:
#include <amxmodx>
#include <fakemeta>
 
public plugin_init()
{
    
register_forward(FM_CmdStart"FwdCmdStart");
}
 
public 
FwdCmdStart(iduc_handle)
{
    static 
ButtonOldButtons;
    
Button get_uc(uc_handleUC_Buttons);
    
OldButtons pev(idpev_oldbuttons);
 
    if((
Button IN_ATTACK2) && !(OldButtons IN_ATTACK2))
    {
        
// Player presses right click
    
}
   
    if((
Button IN_ATTACK2) && (OldButtons IN_ATTACK2))
    {
        
// Player is holding down right click
    
}
    
    if(!(
Button IN_ATTACK2) && (OldButtons IN_ATTACK2))
    {
        
// Player releases right click
    
}

zmd94 is offline
snack_koo
Junior Member
Join Date: Jan 2012
Old 11-16-2014 , 19:46   Re: How to check player hold right mouse then release
Reply With Quote #3

PHP Code:
}
                        if (
iButtons IN_ATTACK2)
                         {
                              if(!
is_user_bot(id))
                    
server_print("Admin right clicked")
                      }
            if(!(
iButtons IN_ATTACK2) && (OldButtons IN_ATTACK2))
            {
                
// Player releases right click            
                
if(!is_user_bot(id))
                    
server_print("Admin right release clicked")
                    
            }
            if((
iButtons IN_ATTACK2) && (OldButtons IN_ATTACK2))
                {
                
// Player is holding down right click
                
if(!is_user_bot(id))
                    
server_print("Admin right holding")
                } 
I'd tried, release not work!
Any ideas?
snack_koo is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-16-2014 , 19:52   Re: How to check player hold right mouse then release
Reply With Quote #4

Just try again. Yet, please follow the sequence given. ;)
zmd94 is offline
snack_koo
Junior Member
Join Date: Jan 2012
Old 11-16-2014 , 20:40   Re: How to check player hold right mouse then release
Reply With Quote #5

Quote:
Originally Posted by zmd94 View Post
Just try again. Yet, please follow the sequence given. ;)
PHP Code:
/* Plugin generated by AMXX-Studio */

#include <amxmodx>
#include <fakemeta>

#define PLUGIN "New Plug-In"
#define VERSION "1.0"
#define AUTHOR "author"


public plugin_init() {
    
register_plugin(PLUGINVERSIONAUTHOR)
    
register_forward(FM_CmdStart"FwdCmdStart");
    
    
// Add your code here...
}
public 
FwdCmdStart(iduc_handle)
{
    static 
ButtonOldButtons;
    
Button get_uc(uc_handleUC_Buttons);
    
OldButtons pev(idpev_oldbuttons);
 
    if((
Button IN_ATTACK2) && !(OldButtons IN_ATTACK2))
    {
        
// Player presses right click
    
server_print("right click")
    }
   
    if((
Button IN_ATTACK2) && (OldButtons IN_ATTACK2))
    {
        
// Player is holding down right click
    
server_print("holding")
    }
    
    if(!(
Button IN_ATTACK2) && (OldButtons IN_ATTACK2))
    {
        
// Player releases right click
    
server_print("release")
    }

I'd tried like this way
never see right-click event appear! what wrong?
snack_koo is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-16-2014 , 20:41   Re: How to check player hold right mouse then release
Reply With Quote #6

Please upload your full code.
zmd94 is offline
snack_koo
Junior Member
Join Date: Jan 2012
Old 11-16-2014 , 22:17   Re: How to check player hold right mouse then release
Reply With Quote #7

Quote:
Originally Posted by zmd94 View Post
Please upload your full code.
Thanks bro anyway! I love you
snack_koo is offline
snack_koo
Junior Member
Join Date: Jan 2012
Old 11-16-2014 , 22:18   Re: How to check player hold right mouse then release
Reply With Quote #8

BTW how to +kama ?
snack_koo is offline
zmd94
Veteran Member
Join Date: Nov 2013
Location: Malaysia (9w2zow).
Old 11-16-2014 , 22:22   Re: How to check player hold right mouse then release
Reply With Quote #9

So, it is working now?
zmd94 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 17:28.


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