Quote:
Originally Posted by PC Gamer
You'll probably want to do something similar to this:
PHP Code:
public Action:OnPlayerRunCmd(client, &buttons, &impulse, Float:vel[3], Float:angles[3], &weapon) { if (client == somevalue && client == someothercondition) { buttons &= IN_ATTACK; return Plugin_Changed; } return Plugin_Continue; }
This code by itself would cause a disaster. I only posted it to show how to force an attack. The OnPlayerRunCmd is always running so the code above will fire constantly while the conditions are met. You'll probably want to put a timer on it to regulate when the attack will stop and start again.
Another option is to use OnTakeDamage which fires when damage is taken.
Note: I'm a TF2 guy so I can't help with specifics regarding L4D2.
|
Thank you very much for the reply, PC Gamer. This helps a bit, but I'm not sure how to integrate it into my code for testing.
As I've said before, I'm a massive noob when it comes to coding. I'm much better with other parts of Source.
I would offer to post my plugin here (or the part of the code I'm working on) in its current state, but it is only a slightly modified version of another plugin that's already available on AlliedModders. And because of that, I don't know if the original creator would be ok with me essentially reuploading their plugin, with minor changes (which, for the most part, remove or break certain features).
My plan was to strip out most of the plugin's features, and make one change to what happens when you press +attack2. So it was just the bare minimum. I could strip out most of the plugin, but it's the pummeling thing that's causing me problems. I just don't know how to start it.