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

[TF2] Force player to always shoot


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Jessecar96
Junior Member
Join Date: Jan 2011
Location: right here
Old 07-23-2011 , 04:34   [TF2] Force player to always shoot
Reply With Quote #1

I'm making a plugin and need to know how to force the players to always shoot their current weapon.

i did a search and found this
PHP Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulseFloat:vel[3], Float:angles[3], &weapon

    if (
client == TheBot /* && some more conditions? */
    { 
        
buttons &= IN_ATTACK
        return 
Plugin_Changed
    } 
    return 
Plugin_Continue

But it doesn't seem to work, any ideas?
Maybe a way of sending the command +attack to the client
Jessecar96 is offline
Send a message via Skype™ to Jessecar96
Kevin_b_er
SourceMod Donor
Join Date: Feb 2009
Old 07-23-2011 , 09:35   Re: [TF2] Force player to always shoot
Reply With Quote #2

That removes all the buttons states except attack. Try
PHP Code:
buttons |= IN_ATTACK 
__________________
Kevin_b_er is offline
berni
SourceMod Plugin Approver
Join Date: May 2007
Location: Austria
Old 07-23-2011 , 10:00   Re: [TF2] Force player to always shoot
Reply With Quote #3

Quote:
Originally Posted by Kevin_b_er View Post
That removes all the buttons states
does it ?
__________________
Why reinvent the wheel ? Download smlib with over 350 useful functions.

When people ask me "Plz" just because it's shorter than "Please" I feel perfectly justified to answer "No" because it's shorter than "Yes"
powered by Core i7 3770k | 32GB DDR3 1886Mhz | 2x Vertex4 SSD Raid0
berni is offline
Jessecar96
Junior Member
Join Date: Jan 2011
Location: right here
Old 07-23-2011 , 13:26   Re: [TF2] Force player to always shoot
Reply With Quote #4

Quote:
Originally Posted by Kevin_b_er View Post
That removes all the buttons states except attack. Try
PHP Code:
buttons |= IN_ATTACK 
That worked. Thanks!
Jessecar96 is offline
Send a message via Skype™ to Jessecar96
Monkeys
Veteran Member
Join Date: Jan 2010
Old 07-23-2011 , 19:28   Re: [TF2] Force player to always shoot
Reply With Quote #5

Quote:
Originally Posted by berni View Post
does it ?
Yeah, it AND's with IN_ATTACK, so only IN_ATTACK can possibly be 1.

If it was ~IN_ATTACK, that'd have been another story, ofcourse ;p
__________________
Get a lid on that zombie,
he's never gonna be alri-i-ight.
Oooh get a lid on that zombie,
or he's gonna feed all night.
Monkeys is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 07-24-2011 , 08:30   Re: [TF2] Force player to always shoot
Reply With Quote #6

He's right. &= is the bitwise AND, and |= is the bitwise OR. For example:

AND:
0110
1100
=
0100

OR:
0110
1100
=
1110

In this case, you'll obviously want to "add" the bit on, therefor you'll want to use the bitwise OR. Check out this wikipedia article or the pawn language guide (around page 108) for more information.
bl4nk 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 05:44.


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