Disabling players to attack?

I was wandering if there is a way to make a player not able to attack. On the FunctionSearch there is a command “AttackDisable()” but it doesn’t work or at least i haven’t been able to get it to.

hook.Add(‘PlayerBindPress’, 0, function(ply, bind)
if string.find( bind, “attack”) then return true end

They can get around this so I wouldn’t recommend that method (can be bypassed). You can also call :Freeze() on the players which will stop gun fire but also movement too.

If you’re using custom SWEP’s I suggest just blocking out PrimaryFire when you don’t want it to be fired.

Ok thanks.

Could you explain how to get around that? Not a tutorial on how to but how it can get bypassed.

It’s something to do with finding if a hook exists, then they counter-write it with a hook that overpowers THAT hook that the scripter put. Therefore, now the player can attack again.

I really don’t know what I just said. I think it makes sense.

If what you are saying is true then why wouldn’t people just overwrite hooks the server provides all day long?

Just type it into console. :v: The hook only blocks binds.

Couldn’t they just use “hook.Remove()”?

The hook is serverside so no.

When i tried it it didn’t work unless it was client side… Or perhaps i’m just using it wrong.

EDIT: I just looked it up and it said that PlayerBindPress is client.