Raised This Month: $ Target: $400
 0% 

Switch on/off by mouse right click


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
johnny40409
Senior Member
Join Date: Mar 2009
Old 04-13-2009 , 10:13   Switch on/off by mouse right click
Reply With Quote #1

Hello , I want to do a plugin ,
I want to switch the thing by using mouse right button ,
How can I do? I've seen bazooka's sma, but I still didn't understand how to do that , can somebody teach me ? thanks!
johnny40409 is offline
hleV
Veteran Member
Join Date: Mar 2007
Location: Lithuania
Old 04-13-2009 , 11:47   Re: Switch on/off by mouse right click
Reply With Quote #2

Not tested.
Code:
#include <amxmodx> #include <fakemeta>   new bool:Switch[33];   public plugin_init()         register_forward(FM_CmdStart, "CmdStart");   public CmdStart(Client, Handle) {         static Buttons, OldButtons;         Buttons = get_uc(Handle, UC_Buttons);         //Buttons = pev(Client, pev_button);         OldButtons = pev(Client, pev_oldbuttons);           if ((Buttons & IN_ATTACK2) && !(OldButtons & IN_ATTACK2))                 Switch[Client] = !Switch[Client]; }
__________________

Last edited by hleV; 04-14-2009 at 10:52. Reason: Updated.
hleV is offline
One
Veteran Member
Join Date: Oct 2008
Location: Hardstyle-eSports.de
Old 04-14-2009 , 10:35   Re: Switch on/off by mouse right click
Reply With Quote #3

Quote:
Originally Posted by hleV View Post
Not tested.
Code:
#include <amxmodx> #include <fakemeta> new bool:Switch[33];

public plugin_init() register_forward(FM_CmdStart, "CmdStart");

public CmdStart(Client, Handle) { static Buttons, OldButtons;
Buttons = get_uc(Handle, UC_Buttons);
//Buttons = pev(Client, pev_button); OldButtons = pev(Client, pev_oldbuttons);

if ((Buttons & IN_ATTACK) && !(OldButtons & IN_ATTACK)) Switch[Client] = !Switch[Client];
}

isnt right mouse attack2 & not ATTACK??
__________________
One is offline
Send a message via ICQ to One Send a message via AIM to One Send a message via MSN to One Send a message via Yahoo to One Send a message via Skype™ to One
SnoW
Veteran Member
Join Date: Oct 2008
Location: Finland WisdomNuggets: 8
Old 04-15-2009 , 08:33   Re: Switch on/off by mouse right click
Reply With Quote #4

Quote:
Originally Posted by One View Post
isnt right mouse attack2 & not ATTACK??
Right mouse is anything you want. The thread seems to be only detecting when user is attacking, if you count ATTACK2 attacking, lolz.
SnoW is offline
Send a message via MSN to SnoW
johnny40409
Senior Member
Join Date: Mar 2009
Old 04-15-2009 , 11:58   Re: Switch on/off by mouse right click
Reply With Quote #5

Quote:
Originally Posted by hleV View Post
Not tested.

Code:
#include <amxmodx></p><p>#include <fakemeta></p><p>&nbsp;</p><p>new bool:Switch[33];</p><p>&nbsp;</p><p>public plugin_init()</p><p> register_forward(FM_CmdStart, "CmdStart");</p><p>&nbsp;</p><p>public CmdStart(Client, Handle)</p><p>{</p><p> static Buttons, OldButtons;</p><p> Buttons = get_uc(Handle, UC_Buttons);</p><p> //Buttons = pev(Client, pev_button);</p><p> OldButtons = pev(Client, pev_oldbuttons);</p><p>&nbsp;</p><p> if ((Buttons & IN_ATTACK2) && !(OldButtons & IN_ATTACK2))</p><p> Switch[Client] = !Switch[Client];</p><p>}
Thanks , it works stablely , ^_^
johnny40409 is offline
YamiKaitou
Has a lovely bunch of coconuts
Join Date: Apr 2006
Location: Texas
Old 04-13-2009 , 12:35   Re: Switch on/off by mouse right click
Reply With Quote #6

PHP Code:
switch (Switch[Client])
                {
                        
// Switch is on, turn it off
                        
case 1: Switch[Client] = false;
                        
// Switch is off, turn it on
                        
case 0: Switch[Client] = true;
                } 
Better method (IMO) would be Switch[Client] = !Switch[Client]
__________________
ProjectYami Laboratories

I do not browse the forums regularly anymore. If you need me for anything (asking questions or anything else), then PM me (be descriptive in your PM, message containing only a link to a thread will be ignored).
YamiKaitou 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 02:27.


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