Raised This Month: $ Target: $400
 0% 

Restricting buttons


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Bruno
Member
Join Date: Jun 2005
Old 07-24-2005 , 12:02   Restricting buttons
Reply With Quote #1

How do I restrict buttons from being used? Buttons like crouching, kicking, punching, shooting, etc.
Bruno is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 07-24-2005 , 12:10  
Reply With Quote #2

You dont restrict the buttons...ill give you a quick tutorial.
Code:
#include <amxmodx> public plugin_init() {     register_plugin("Action Stopper","1.0","$uicid3")     register_cvar("amx_stop_attack","0")     register_cvar("amx_stop_walk","0")     register_cvar("amx_stop_duck","0")     register_concmd("+attack","HookAttack",0)     register_concmd("+speed","HookWalk",0)     register_concmd("+duck","HookDuck",0) } public HookAttack(id) {     switch(get_cvar_num("amx_stop_attack"))     {         case 1: return PLUGIN_HANDLED  //Stop the action         default: return PLUGIN_CONTINUE //continue the action     }     return PLUGIN_CONTINUE } public HookWalk(id) {     switch(get_cvar_num("amx_stop_walk"))     {         case 1: return PLUGIN_HANDLED         default: return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE } public HookDuck(id) {     switch(get_cvar_num("amx_stop_duck"))     {         case 1: return PLUGIN_HANDLED         default: return PLUGIN_CONTINUE     }     return PLUGIN_CONTINUE }
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
v3x
Veteran Member
Join Date: Oct 2004
Location: US
Old 07-24-2005 , 12:15  
Reply With Quote #3

I'm not so sure if you can actually block the default +/- commands.
__________________
What am I doing these days? Well, I run my own Rust server. It's heavily modded. If you'd like to join, the ip is 167.114.101.67:28116

I also created a website called Rust Tools. It will calculate and tell you the raw amounts of resources needed to craft items.
v3x is offline
Xanimos
Veteran Member
Join Date: Apr 2005
Location: Florida
Old 07-24-2005 , 12:18  
Reply With Quote #4

Well if you can then that would do it....lol
Xanimos is offline
Send a message via AIM to Xanimos Send a message via MSN to Xanimos
Bruno
Member
Join Date: Jun 2005
Old 07-24-2005 , 12:20  
Reply With Quote #5

Thanks man. That was fast.
Bruno is offline
AssKicR
Veteran Member
Join Date: Mar 2004
Location: Norway-Europe(GTM+1)
Old 07-24-2005 , 14:06  
Reply With Quote #6

That will not work.. you cannot hook default +/- commands with registering them

You need to get EV_INT_button in client_prethink and reset them if containing the button in question

like

Code:
public client_PreThink(id) {     if(!is_user_alive(id)) return PLUGIN_CONTINUE     if((bufferstop & IN_JUMP) ) {         entity_set_int(id,EV_INT_button,entity_get_int(id,EV_INT_button) & ~IN_JUMP)     } }
__________________
My Plugins

Got ??
AssKicR is offline
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 07-24-2005 , 14:11  
Reply With Quote #7

+attack isn't actually sent to the server as +attack, simply because it is too long of a string to constantly send to the server... Instead, a byte-code is sent which is sent alot faster.. Since +attack is used sooo often, it would be a nightmare to actually send the whole string...

Other commands that are sent to the server very often may also be sent as a byte-code.. Thus, it is alot harder to hook them...

However, you can still check for it by doing something like:
Code:
if( get_user_button(id) & IN_ATTACK ) {     // blah blah blah... }
xeroblood is offline
Send a message via MSN to xeroblood
Mind
Junior Member
Join Date: May 2005
Location: Sweden
Old 08-17-2005 , 19:14  
Reply With Quote #8

This doesnt work at all as intended. It triggers when I move right, I tested that out with screenshake but the way to block movement, as you all suggest in this thread and various other threads, simply doesnt seem to do anything. Am I doing something wrong here?

Code:
public client_PreThink(id) {       if(get_user_button(id)&IN_MOVERIGHT)     {     //  message_begin(MSG_ONE,ScreenShake,{0,0,0},id);     //  write_short( 1<<14 );     //  write_short( 1<<14 );     //  write_short( 1<<14 );     //  message_end();     // entity_set_int(id,EV_INT_button,get_user_button(id)&-IN_MOVERIGHT);     }     return; }
Mind is offline
Send a message via ICQ to Mind
Mind
Junior Member
Join Date: May 2005
Location: Sweden
Old 08-17-2005 , 20:27  
Reply With Quote #9

Nevermind my last post, I have concluded that it is impossible to stop people from +jump ing or +duck ing by blocking the +commands.
Have to do a workaround of some sort.
Mind is offline
Send a message via ICQ to Mind
xeroblood
BANNED
Join Date: Mar 2004
Location: Toronto, Canada
Old 08-17-2005 , 22:53  
Reply With Quote #10

Quote:
Originally Posted by Mind
Code:
public client_PreThink(id) {       if(get_user_button(id)&IN_MOVERIGHT)     { entity_set_int(id,EV_INT_button,get_user_button(id)&-IN_MOVERIGHT);     }     return; }
You put a Minus Sign in place of the Logical NOT sign, which gives you an incorrect bit-sum..

Instead of the Minus Sign, you must use the Tilde Sign '~' here:
Code:
entity_set_int(id,EV_INT_button,get_user_button(id) & ~IN_MOVERIGHT);
xeroblood is offline
Send a message via MSN to xeroblood
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 16:46.


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