Ulysses

General => Developers Corner => Topic started by: MrPresident on July 18, 2010, 09:28:20 AM

Title: Garrysmod specific lua question.
Post by: MrPresident on July 18, 2010, 09:28:20 AM
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.
Title: Re: Garrysmod specific lua question.
Post by: JamminR on July 18, 2010, 09:43:41 AM
Gamemode.SpawnMenuOpen (http://wiki.garrysmod.com/favicon.ico) (http://wiki.garrysmod.com/?title=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 (http://wiki.garrysmod.com/favicon.ico) (http://wiki.garrysmod.com/?title=Gamemode.OnSpawnMenuOpen) - Any gamemode
Gamemode.OnSpawnMenuClose (http://wiki.garrysmod.com/favicon.ico) (http://wiki.garrysmod.com/?title=Gamemode.OnSpawnMenuClose) - Any gamemode.

Also related;
Gamemode.OnContextMenuOpen (http://wiki.garrysmod.com/favicon.ico) (http://wiki.garrysmod.com/?title=Gamemode.OnContextMenuOpen)
Gamemode.OnContextMenuClose (http://wiki.garrysmod.com/favicon.ico) (http://wiki.garrysmod.com/?title=Gamemode.OnContextMenuClose)
Title: Re: Garrysmod specific lua question.
Post by: MrPresident on July 18, 2010, 09:58:59 AM
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: [Select]
function GM:OnSpawnMenuOpen()
gui.EnableScreenClicker(true)
end

function GM:OnSpawnMenuClose()
gui.EnableScreenClicker(false)
end
Title: Re: Garrysmod specific lua question.
Post by: Megiddo on July 18, 2010, 12:07:35 PM
Think those hooks are the right track
Title: Re: Garrysmod specific lua question.
Post by: MrPresident on July 18, 2010, 12:26:11 PM
I figured it out.. see my previous post which I edited.
Title: Re: Garrysmod specific lua question.
Post by: Stickly Man! on July 18, 2010, 11:52:50 PM
Aww, I got here too slow :(

Dunno if you found this yet either, but you should also use the save/restore mouse positions (gui.rememberMousePosition?? Or something like that) when enabling and disabling the screen clicker so it doesn't reset to the center each time.

Unless the functionality of enableScreenClicker has changed since I began work on XGUI