AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Blocking all user input (https://forums.alliedmods.net/showthread.php?t=60799)

purple_pixie 09-13-2007 08:17

Blocking all user input
 
How much am I going to need to hook if I want to basically block all user input.

What it needs to block:
All movement ( jump, duck and walking/running )
Change weapons
Firing ( hopefully sorted - found a thread on the subject)

[I'll want to allow a few commands (say/name), but I can probably filter these myself ]

And I'm hoping to be able to fake all of this too.

The end result would be to have players controllable by another player.

I don't need code for how to do this, just the commands I'm looking at hooking - I should be able to pick up most of the rest.
Though naturally if there are threads about blocking/faking any of this it would be handy.

Lord_Destros 09-14-2007 00:40

Re: Blocking all user input
 
http://forums.alliedmods.net/showthr...ighlight=block

Quote:

Originally Posted by hlsdk_const.inc
// pev(entity, pev_button) or pev(entity, pev_oldbuttons) values
#define IN_ATTACK (1<<0)
#define IN_JUMP (1<<1)
#define IN_DUCK (1<<2)
#define IN_FORWARD (1<<3)
#define IN_BACK (1<<4)
#define IN_USE (1<<5)
#define IN_CANCEL (1<<6)
#define IN_LEFT (1<<7)
#define IN_RIGHT (1<<8)
#define IN_MOVELEFT (1<<9)
#define IN_MOVERIGHT (1<<10)
#define IN_ATTACK2 (1<<11)
#define IN_RUN (1<<12)
#define IN_RELOAD (1<<13)
#define IN_ALT1 (1<<14)
#define IN_SCORE (1<<15) // Used by client.dll for when scoreboard is held down


purple_pixie 09-14-2007 04:02

Re: Blocking all user input
 
Yeah, I found that one.
Blocking buttons is all well and good, but they can still move (albeit slowly)

I might just have to play around a lot.

Thans, though.

potatis_invalido 09-14-2007 07:37

Re: Blocking all user input
 
Try to set the max speed of a player to 0.

purple_pixie 09-14-2007 08:04

Re: Blocking all user input
 
cl_forwardspeed?

Or is there a serverside player maxspeed?

And the real bitch is that I don't actually want to stop them moving.
I just want them to completely ignore what the user is pressing.
The player needs to move when told to ... but I can do that by popping up maxspeed when the controlling player tells them to move, I suppose.

Why do I feel this is going to be hard ... ah, well - what better way to learn than projects way outside your experience :-D

Wilson [29th ID] 09-14-2007 08:19

Re: Blocking all user input
 
If you block the buttons, it will not move "a little bit." It will not move at all. Search the forums for IN_FORWARD and such and you'll find loads of scripting help threads were we help people with that.

Also, check out jedi_force_grab. That plugin sets a user's velocity to where you are aiming, and no matter what that user does movement wise, he moves to that velocity. He will still look like he is running, animation wise, but that could be blocked too.

As far as firing, yeah, like you said that's easy you got that done.

Changing weapons is a bit more difficult because you cannot block commands like slot2, nextinv, lastinv, etc. As well as when you drop a weapon you pull another out.

What I would reccomend is to alter the pev_weapons variable and only give it the weapon he currently has out. Also block the drop command so he can't do what I just said. If there are still ways he can switch weapons after that (test it a lot), hook CurWeapon and switch him back.

purple_pixie 09-14-2007 08:30

Re: Blocking all user input
 
Spot the legend :-D

And I tried doing:
set_pev(id,pev_buttons,0)

Which I'm pretty sure would remove all buttons, in the player prethink ... where should it be done?

Anyways, thanks for the reply - I'll have another search around for the button constants, try to find these threads you speak of.


All times are GMT -4. The time now is 16:07.

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