AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Scripting Help (https://forums.alliedmods.net/forumdisplay.php?f=11)
-   -   Out of curiosity ... (https://forums.alliedmods.net/showthread.php?t=5442)

Mugwump 09-01-2004 19:16

Out of curiosity ...
 
Is it possible to block a player's ability to duck or jump? Don't recall seeing examples so am wondering ...

-Mug

Peli 09-01-2004 19:18

Maybe if you take off their two binds +jump and +duck , then you stop them from ever binding a command like that. :roll:

PM 09-01-2004 19:25

I have tried doing this some time ago with the old engine module, and ended up with only being able to see whether they hold a button down and stuff like that.
Anyway, like you probably know, duck and jump are handled client-side and the server only has a bit set in the pEdict->v.button integer.
Most (if not all) of the button handling seems to be done in CBasePlayer::PreThink. So if you could hook PreThink and remove the jump and duck bits from the EV_INT_button integer (for example by doing button=button & ~(IN_JUMP | IN_CROUCH); ), you would be probably done. I don't know whether I haven't tried this (I only remember setting buttons before the actual Think function but not PreThink, but it is a pretty long time ago) or why i wasn't able to block the buttons - but I think it should be possible somehow.

Hope I have helped :D

Votorx 09-01-2004 19:27

Lol either that or every time they try rebinding just unbind it again.

Twilight Suzuka 09-01-2004 20:23

What about running a server_frame, test to see if they are pressing it, and run -jump or -duck each time they do?

Johnny got his gun 09-02-2004 04:29

Yes. With the new Fakemeta module this could indeed be possible, doing it the way PM explained.

Pseudo-plugin (might work, might not, might create overhead):


Code:
#include <amxmodx> #include <fakemeta> #include <engine> public forward_playerprethink(id) {     entity_set_int(id, EV_INT_button, entity_get_int(id, EV_INT_button) & ~(IN_JUMP | IN_DUCK)) } public plugin_init() {     register_plugin("No crouching tiger, no jumping dragon", "0.1", "GWB")     register_forward(FM_PlayerPreThink, "forward_playerprethink") }

Mugwump 09-02-2004 16:50

Thanks for the suggestions, great help in this thread!

One question though, I'm rusty on my bitwise operations, what would the inverse command be to restore the jump and duck abilities? I'm drawing a blank *sigh *

Thanks again!
-Mug

Johnny got his gun 09-02-2004 17:04

I tried this. It didn't work as expected. I could only partly block ducking, but it's in another entity member (ev_int_binduck), and somehow I could crouch if I was in midair while pressing duck button.
These things are probably set somewhere else...

Freecode 09-02-2004 17:06

its proly checking if ur on ground and ducking

kalel 09-02-2004 17:46

the easyst way to do this would to install a exec mod so u can bind and unbind keys

wich u can find here http://forums.alliedmods.net/showthread.php?p=3313

then do this

bind del "amx_execall unbind ctrl" and that will unbind every one's ctrl key

this is also go for runing this coommand wich I do to every one on my server

"amx_execall cl_cmdrate 9999;amx_execall rate 9999;fsp_max 9999;say @@g Every One's Computers Have Been Tweeked For Best Game Play Results;amx_execall net_graph 1"


All times are GMT -4. The time now is 17:21.

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