Raised This Month: $ Target: $400
 0% 

CS:S Prevent person from firing weapon


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
alandarev
Member
Join Date: Aug 2012
Old 05-29-2013 , 17:14   CS:S Prevent person from firing weapon
Reply With Quote #1

Earlier, I would use the following command to stop a client from firing a weapon (He would have animation triggered client-side but the fire action does not actually happen):
SetEntProp(client, Prop_Send, "m_nButtons", 0); < On PreThink Hook (SDKHooks)

Unfortunately, since some pre-steampipe update it now throws an error that m_nButtons property is not found.

Any suggestions on how to stop client from firing a weapon now?

Last edited by alandarev; 05-29-2013 at 17:14.
alandarev is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 05-29-2013 , 17:17   Re: CS:S Prevent person from firing weapon
Reply With Quote #2

PHP Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon
{   
        if(
buttons IN_ATTACK
        { 
                
buttons &= ~IN_ATTACK;
        }

__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
alandarev
Member
Join Date: Aug 2012
Old 05-29-2013 , 17:27   Re: CS:S Prevent person from firing weapon
Reply With Quote #3

Quote:
Originally Posted by Franc1sco View Post
PHP Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon
{   
        if(
buttons IN_ATTACK
        { 
                
buttons &= ~IN_ATTACK;
        }

Thank you for a quick response, I am going to try this method.
In addition I would like to block player's attempts to move/jump/duck, I will try the following somewhere around this week:
PHP Code:
    buttons &= ~(IN_ATTACK IN_JUMP IN_DUCK IN_FORWARD IN_BACK IN_MOVELEFT IN_MOVERIGHT
alandarev is offline
Franc1sco
Veteran Member
Join Date: Oct 2010
Location: Spain (Madrid)
Old 05-30-2013 , 05:34   Re: CS:S Prevent person from firing weapon
Reply With Quote #4

Quote:
Originally Posted by alandarev View Post
Thank you for a quick response, I am going to try this method.
In addition I would like to block player's attempts to move/jump/duck, I will try the following somewhere around this week:
PHP Code:
    buttons &= ~(IN_ATTACK IN_JUMP IN_DUCK IN_FORWARD IN_BACK IN_MOVELEFT IN_MOVERIGHT
If you want block player´s move you can teleport player to same position, for example:


Prevent that Ts players can go back
PHP Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon)
{
    if (
GetClientTeam(client) == 2)
    {
        if (
buttons IN_BACK)
        {
            
PrintHintText(client"You can not go back!");
            
TeleportEntity(clientNULL_VECTORanglesNULL_VECTOR);
            
vel[0] = 0.0;    
        }
    }
        
    return 
Plugin_Continue;

__________________
Veteran Coder -> Activity channel
Coding on CS2 and taking paid and free jobs.

Contact: Steam, Telegram or discord ( franug ).

You like my work? +Rep in my steam profile comments or donate.

Franc1sco is offline
Send a message via MSN to Franc1sco
TnTSCS
AlliedModders Donor
Join Date: Oct 2010
Location: Undisclosed...
Old 05-30-2013 , 09:44   Re: CS:S Prevent person from firing weapon
Reply With Quote #5

if you want to block a player's movement, freeze them Set their move type
__________________
View my Plugins | Donate
TnTSCS is offline
GoD-Tony
Veteran Member
Join Date: Jul 2005
Old 05-30-2013 , 11:34   Re: CS:S Prevent person from firing weapon
Reply With Quote #6

Quote:
Originally Posted by alandarev View Post
Thank you for a quick response, I am going to try this method.
In addition I would like to block player's attempts to move/jump/duck, I will try the following somewhere around this week:
PHP Code:
    buttons &= ~(IN_ATTACK IN_JUMP IN_DUCK IN_FORWARD IN_BACK IN_MOVELEFT IN_MOVERIGHT
Small correction:
PHP Code:
buttons &= ~(IN_ATTACK IN_JUMP IN_DUCK IN_FORWARD IN_BACK IN_MOVELEFT IN_MOVERIGHT
__________________
GoD-Tony is offline
friagram
Veteran Member
Join Date: Sep 2012
Location: Silicon Valley
Old 05-31-2013 , 00:53   Re: CS:S Prevent person from firing weapon
Reply With Quote #7

You can set the nextattck on the weapon to something high, which will prevent it from being able to fire. This will also prevent any client side prediction which you would otherwise see by just blocking buttons.
__________________
Profile - Plugins
Add me on steam if you are seeking sp/map/model commissions.

Last edited by friagram; 05-31-2013 at 00:54.
friagram 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:56.


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