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

[TF2] Block Weapon Shoot on specific event (Then at specific event unfreeze)


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Oshizu
Veteran Member
Join Date: Nov 2012
Location: Warsaw
Old 01-05-2014 , 13:18   [TF2] Block Weapon Shoot on specific event (Then at specific event unfreeze)
Reply With Quote #1

Hi guys i'm looking for some way to block weapon fire so player can't shoot with it
And then be able to unblock weapon so they will be able to shoot with it

- Thanks
__________________
...
Oshizu is offline
oplkill
Member
Join Date: Aug 2015
Old 04-22-2017 , 16:01   Re: [TF2] Block Weapon Shoot on specific event (Then at specific event unfreeze)
Reply With Quote #2

Sorry for necrocommenting, but this post is a first in search and without answer...

Code:
new bool:blockWeapons;

public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon)
{
    if(!blockWeapons)
        return Plugin_Continue;

    if(buttons & IN_ATTACK)
    {
	buttons &= ~IN_ATTACK;
	return Plugin_Changed;
    }
	
    return Plugin_Continue;
}
oplkill is offline
nosoop
Veteran Member
Join Date: Aug 2014
Old 04-23-2017 , 04:10   Re: [TF2] Block Weapon Shoot on specific event (Then at specific event unfreeze)
Reply With Quote #3

For TF2 (and possibly other games), you can update either the player's m_flNextAttack netprop or their individual weapons' m_flNextPrimaryAttack or m_flNextSecondaryAttack netprops to a higher number to avoid the prediction issues caused by hooking and blocking the attack button.

Here's an existing sample plugin to demonstrate it. Note that the netprop has to be updated on weapon switch.
__________________
I do TF2, TF2 servers, and TF2 plugins.
I don't do DMs over Discord -- PM me on the forums regarding inquiries.
AlliedModders Releases / Github / TF2 Server / Donate (BTC / BCH / coffee)
nosoop 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 03:04.


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