Run function on mouse middle click

Since I fixed my FastDL issue, I moved on to finishing the rest of my game mode.

I decided on the GryMod Crysis HUD. It all works fine, but I need a way to call +crysishud on middle click so that it will bring up the suit interface (armor, strength, speed, etc.), and I need this to be available to every client.
Essentially, press = interface appears; release = disappears. I tried RunConsoleCommand( “bind”, “mouse3”, “+crysishud”), but then ran into bind being blocked.

I also tried GM:KeyPress() and GM:KeyRelease(), but MOUSE doesn’t translate to KEY.

Now I’m trying to get input.IsMouseDown(MOUSE_MIDDLE) to work, but no luck so far. I keep getting an error that input is nil.
Here’s my latest attempt in clientside.

local ply = LocalPlayer()

function CryHUD( ply )
if not IsValid( ply ) then

if ( input.IsMouseDown( MOUSE_MIDDLE ) ) then


hook.Add( “Think”, “CryHUD”, CryHud)[/LUA]

At this point, I’m just tweaking it to see what works, but nothing yet. Any ideas?

I tried something different to see if it would work, but still no.

[LUA]Mid = index.IsMouseDown( MOUSE_MIDDLE )

while (Mid == true) do

It still says input has a nil value. What would I define input as here?

[editline]23rd December 2012[/editline]

Also tried this.

[LUA]function input.IsMouseDown( mc )
if mc == MOUSE_MIDDLE then RunConsoleCommand("+crysishud")
else RunConsoleCommand("-crysishud") end
Still tells me input is nil.

If the input library isn’t loading automatically, is there a way I could invoke it in server start?