[Any] How can I send keyboard inputs to clients?
3/24/2023: I gave up on this. My brain is fried. I can't make the original plugin that I wanted to because I don't know how to code.
If you're interested in what I was trying to do just read down below. Feel free to take on what I was trying to do I don't care. Original post: Hi. Is it possible to send keyboard inputs (such as +attack) to clients? I'm working on a plugin which requires the user (or a bot) to press +attack at very specific points for it to work properly. Any and all help would be greatly appreciated. TotalChaos. |
Re: [Any] How can I send keyboard inputs to clients?
https://sm.alliedmods.net/new-api/sd...OnPlayerRunCmd
the "buttons" parameter. buttons |= IN_ATTACK; |
Re: [Any] How can I send keyboard inputs to clients?
Quote:
Again, I am very bad with coding, so for all I know this is the solution (I'm not even sure how to set it up). Remember, I'm looking for a solution that works with both human players, and bots. I don't want just one or the other. Sorry if this comes off as rude, that's not my intention. |
Re: [Any] How can I send keyboard inputs to clients?
change it on OnPlayerRunCmd or PreThink, but usually doesn't works well because of prediction issues
for bots you can try calling CommandABot vscript command. |
Re: [Any] How can I send keyboard inputs to clients?
Quote:
Like I said above, I'm not that good with coding. Even if I understood that, I have absolutely no idea how to set it up. That's one of my many problems with the SourcePawn documentation. There's no examples on how to set it up. How are newbies like me supposed to learn without any examples? And, knowing Google, how am I supposed to search for examples? If any of this comes off as rude, I'm sorry. That's not my intention. |
Re: [Any] How can I send keyboard inputs to clients?
Alright, I'm going to go into a bit more detail with what I'm trying to do.
I want to force-trigger the Charger's pummeling ability in Left 4 Dead 2, on command. I already have a plugin that I'm modifying that gets me most of the way there, but there's one small piece of the puzzle that I'm missing. And that's the pummeling thing. +attack triggers the pummeling while you're holding a Survivor, but it only works on the player's input. That's why I want to send that input to a human player/bot, so that I can force them to start pummeling the Survivor. I tried using Left 4 DHooks, but I'm not sure how to use some of that stuff. EDIT: If there's a better way to trigger this, please let me know. I've tried absolutely everything I can think of. Nothing is working. The +attack thing was my last guess, outside of forcing a charge (neither of which I know how to do). Sorry if this is too much information, or if it strays too far from my original question. |
Re: [Any] How can I send keyboard inputs to clients?
You'll probably want to do something similar to this:
PHP Code:
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. |
Re: [Any] How can I send keyboard inputs to clients?
Quote:
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. |
Re: [Any] How can I send keyboard inputs to clients?
is basically a copy+paste, has a lot of examples in the forum
https://www.google.com/search?q=OnPl...alliedmods.net https://forums.alliedmods.net/showthread.php?t=315053 |
Re: [Any] How can I send keyboard inputs to clients?
Quote:
But I think I fried my brain trying to figure out why my original attempts weren't working, and I just realized that there's a ton of other stuff I would have to do to get this working. So I think I'm just gonna stop working on the plugin for now. For anyone who's curious, this is the plugin I was modifying: https://forums.alliedmods.net/showthread.php?p=2605254 It was originally a recreation of the pre-release Charger (+attack = charge, don't grab Survivors, send them flying, +attack2 = instantly pummel the Survivor instead of using the claw attack). But it seems like the creator went in a bit of a different direction with the plugin, for whatever reason. I wanted to finish the original idea with the plugin. But this is proving to be far too difficult for me. And, seeing as the original creator doesn't want to work on it anymore, I don't think this would be happening anytime soon. Thanks for all the help. |
| All times are GMT -4. The time now is 21:05. |
Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.