Raised This Month: $51 Target: $400
 12% 

Blocking Commands?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Exino
Junior Member
Join Date: Mar 2008
Old 05-16-2008 , 07:38   Blocking Commands?
Reply With Quote #1

Does anyone know of a way to block commands in SourceMod? I, for instance, specifically want to block "+attack" for a set amount of time after the client jumps. I want this to work on bots as well.
Exino is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 05-16-2008 , 12:53   Re: Blocking Commands?
Reply With Quote #2

Hook the command and "return Plugin_Handled;". Some things can not be blocked though as they happen client side as well.
bl4nk is offline
L. Duke
Veteran Member
Join Date: Apr 2005
Location: Walla Walla
Old 05-16-2008 , 13:51   Re: Blocking Commands?
Reply With Quote #3

+attack is handled client side. It gets sent to the server and can be seen in the ProcessUsrcmds function. I think that you can access them in sourcemod using the GetClientButtons command. Check the SourceMod API.
__________________
"Good grammar is essential, Robin."
- Batman
L. Duke is offline
raydan
Senior Member
Join Date: Aug 2006
Old 05-17-2008 , 00:33   Re: Blocking Commands?
Reply With Quote #4

in amxmodx, it can use register_forward(FM_CmdStart,"xxx"); then something like "buttons &= ~IN_ATTACK"

is there any same function in sourcemod?
raydan is offline
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 05-17-2008 , 00:41   Re: Blocking Commands?
Reply With Quote #5

PHP Code:
if( GetClientButtons(client) & IN_ATTACK 
{
   
//...

List of constants:
http://docs.sourcemod.net/api/index....ad=file&id=47&
__________________
http://www.nican132.com
I require reputation!
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
raydan
Senior Member
Join Date: Aug 2006
Old 05-17-2008 , 01:15   Re: Blocking Commands?
Reply With Quote #6

Quote:
Originally Posted by Nican View Post
PHP Code:
if( GetClientButtons(client) & IN_ATTACK 
{
   
//...

if "return Plugin_Handled" in here. all command will be blocked
should be a way to remove "IN_ATTACK"
raydan is offline
SAMURAI16
BANNED
Join Date: Sep 2006
Old 05-17-2008 , 04:54   Re: Blocking Commands?
Reply With Quote #7

something like this:
Code:
public blah(client) {     new buttons = GetClientButtons(client);         if(buttons & IN_ATTACK)         buttons &= ~IN_ATTACK;         SetClientButtons(client,buttons); } public SetClientButtons(client,button) {     if(IsClientConnected(client) && IsClientInGame(client))         SetEntProp(client, Prop_Data, "m_nButtons", button); }

Depends when is called, and about a 'return Plugin_Handled' I remember too, on HL1 it was necessary to call after removing ATTACK from a client
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
Nican
Veteran Member
Join Date: Jan 2006
Location: NY
Old 05-17-2008 , 10:45   Re: Blocking Commands?
Reply With Quote #8

There is no such command as "SetClientButtons"...

My suggestion would be getting CBaseCombatWeapon::m_flNextPrimaryAttack of the player is holding and setting it to a value to something like GetGameTime() + 500.0
__________________
http://www.nican132.com
I require reputation!
Nican is offline
Send a message via ICQ to Nican Send a message via MSN to Nican
SAMURAI16
BANNED
Join Date: Sep 2006
Old 05-17-2008 , 12:01   Re: Blocking Commands?
Reply With Quote #9

Quote:
Originally Posted by Nican View Post
There is no such command as "SetClientButtons"...
look again

About CBaseCombatWeapon::m_flNextPrimaryAttack i'm almost agree with that

Last edited by SAMURAI16; 05-17-2008 at 12:04.
SAMURAI16 is offline
Send a message via MSN to SAMURAI16
raydan
Senior Member
Join Date: Aug 2006
Old 05-18-2008 , 00:20   Re: Blocking Commands?
Reply With Quote #10

m_flNextPrimaryAttack only work on IN_ATTACK, how about prevent player jump or couch?
raydan 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 01:40.


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