Author Topic: Garrysmod specific lua question.  (Read 3420 times)

0 Members and 1 Guest are viewing this topic.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Garrysmod specific lua question.
« 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.

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: Garrysmod specific lua question.
« Reply #1 on: July 18, 2010, 09:43:41 AM »
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
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Garrysmod specific lua question.
« Reply #2 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
« Last Edit: July 18, 2010, 12:21:24 PM by MrPresident »

Offline Megiddo

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 6214
  • Karma: 394
  • Project Lead
Re: Garrysmod specific lua question.
« Reply #3 on: July 18, 2010, 12:07:35 PM »
Think those hooks are the right track
Experiencing God's grace one day at a time.

Offline MrPresident

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 2728
  • Karma: 430
    • |G4P| Gman4President
Re: Garrysmod specific lua question.
« Reply #4 on: July 18, 2010, 12:26:11 PM »
I figured it out.. see my previous post which I edited.

Offline Stickly Man!

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 1270
  • Karma: 164
  • What even IS software anymore?
    • XGUI
Re: Garrysmod specific lua question.
« Reply #5 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
Join our Team Ulysses community discord! https://discord.gg/gR4Uye6