AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting (https://forums.alliedmods.net/forumdisplay.php?f=107)
-   -   [CSGO]Any way to force +attack? (https://forums.alliedmods.net/showthread.php?t=259607)

Brrdy 03-09-2015 20:09

[CSGO]Any way to force +attack?
 
Well tried a bunch of stuff now coming here ^_^

shavit 03-09-2015 22:16

Re: [CSGO]Any way to force +attack?
 
afaik in OnPlayerRunCmd you can force &buttons to have the bitflag IN_ATTACK and return Plugin_Changed;

Brrdy 03-10-2015 10:12

Re: [CSGO]Any way to force +attack?
 
Quote:

Originally Posted by shavit (Post 2271952)
afaik in OnPlayerRunCmd you can force &buttons to have the bitflag IN_ATTACK and return Plugin_Changed;

Mind setting it up a little different I tried doing it with just buttons &= IN_ATTACK;

Exolent[jNr] 03-10-2015 10:16

Re: [CSGO]Any way to force +attack?
 
Quote:

Originally Posted by Brrdy (Post 2272154)
Mind setting it up a little different I tried doing it with just buttons &= IN_ATTACK;

&= won't add the bit. You need to use |= instead.

& - Matches 2 bitsums for like bits
| - Combines 2 bitsums to keep positive bits

Brrdy 03-10-2015 10:18

Re: [CSGO]Any way to force +attack?
 
Quote:

Originally Posted by Exolent[jNr] (Post 2272156)
&= won't add the bit. You need to use |= instead.

& - Matches 2 bitsums for like bits
| - Combines 2 bitsums to keep positive bits

Aww okay so just have it do onplayeruncmd() then have it do the same thing but with a |???

shavit 03-12-2015 01:33

Re: [CSGO]Any way to force +attack?
 
Quote:

Originally Posted by Brrdy (Post 2272159)
Aww okay so just have it do onplayeruncmd() then have it do the same thing but with a |???

pseudo code of the old syntax (I have no idea if they added object-orienated programming yet):
Code:

public Action:OnPlayerRunCmd(client, &buttons)
{
          if(!(buttons & IN_ATTACK))
          {
                    buttons |= IN_ATTACK;
                    return Plugin_Changed;
          }
         
          return Plugin_Continue;
}

Sorry if it doesn't work, I didn't use SourceMod in about a year

D.Moder 03-12-2015 08:26

Re: [CSGO]Any way to force +attack?
 
Quote:

Originally Posted by shavit (Post 2272847)
pseudo code of the old syntax (I have no idea if they added object-orienated programming yet):
Code:

public Action:OnPlayerRunCmd(client, &buttons)
{
          if(!(buttons & IN_ATTACK))
          {
                    buttons |= IN_ATTACK;
                    return Plugin_Changed;
          }
         
          return Plugin_Continue;
}

Sorry if it doesn't work, I didn't use SourceMod in about a year

Oh it will. But I hope this guy knows that he needs to add the condition of when to force attack and when to release
buttons &= ~IN_ATTACK will remove the bit.

WildCard65 03-12-2015 10:15

Re: [CSGO]Any way to force +attack?
 
Quote:

Originally Posted by D.Moder (Post 2272922)
Oh it will. But I hope this guy knows that he needs to add the condition of when to force attack and when to release
buttons &= ~IN_ATTACK will remove the bit.

In all honesty, one shouldn't need to worry about removing a bitstring as the client itself handles re-updating the server's OnPlayerRunCommand button param everytime the method is called. Most of time removing a key press would be if you want something to happen for 1 frame quickly.

Brrdy 03-12-2015 10:19

Re: [CSGO]Any way to force +attack?
 
Oh yeah by the way I set it up to attach to +zoom so when I use an awp it runs the stock I have setup :) Thanks for help/suggestions :)


All times are GMT -4. The time now is 18:50.

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