General > Developers Corner

Garrysmod specific lua question.

(1/2) > >>

MrPresident:
Just thought I'd rub your noggins before I try Facepunch... because trying to get info from them is like trying to pull teeth..


1. Do you know if it's possible to override the 'Q-Menu' Hook. So that when pressing Q it does something else? Example, in a gamemode I am working on, I would like the allow the user to free their mouse by pressing Q without actually displaying the Q menu.


No need to research this... just if anyone knows off the top of their head. I'm going to continue to look for an answer and I'll post it if I find it. Thanks.

JamminR:
Gamemode.SpawnMenuOpen - Seems to be Sandbox derivative only.

The following aren't Sandbox specific, and not sure returning anything on the following will halt, but perhaps you could run commands to close it again.
Gamemode.OnSpawnMenuOpen - Any gamemode
Gamemode.OnSpawnMenuClose - Any gamemode.

Also related;
Gamemode.OnContextMenuOpen
Gamemode.OnContextMenuClose

MrPresident:
Yeah Jam, I found those after poking around in the Wiki a little bit, but I don't know if they will do what I want them to. I am currently trying to use my lovely internet here to finish updating Gmod so I can test some things out.

Thanks for the quick reply though.


EDIT:

I figured it out. In case anyone else is wondering how this is possible here is what I had to do.

I replaced the cl_spawnmenu.lua file in my gamemode. In that file there is a function at the top that lets you set the spawnmenu to disabled.
After that I used the following in a client lua file.


--- Code: ---function GM:OnSpawnMenuOpen()
gui.EnableScreenClicker(true)
end

function GM:OnSpawnMenuClose()
gui.EnableScreenClicker(false)
end

--- End code ---

Megiddo:
Think those hooks are the right track

MrPresident:
I figured it out.. see my previous post which I edited.

Navigation

[0] Message Index

[#] Next page

Go to full version