Author Topic: ULX Clientside derma menu  (Read 3219 times)

0 Members and 2 Guests are viewing this topic.

Offline BobTheDuck69

  • Newbie
  • *
  • Posts: 33
  • Karma: 1
ULX Clientside derma menu
« on: June 24, 2015, 10:37:50 PM »
This is what im working with
_________________________________________________________________________________________________________________________________

local menu = DermaMenu()
menu:AddOption( "Request Backup", function() RunConsoleCommand( "say","@Need some backup on this sit!" ) end )
menu:AddOption( "God Mode On", function() RunConsoleCommand( "say","!god ^" ) end )
menu:AddOption( "God Mode Off", function() RunConsoleCommand( "say","!ungod ^" ) end )
menu:AddOption( "Heal Me", function() RunConsoleCommand( "say","!hp ^ 100" ) end )
menu:AddOption( "Heal User", function() RunConsoleCommand( "say","!hp @ 100" ) end )
menu:AddOption( "Armor Me", function() RunConsoleCommand( "say","!armor ^ 100" ) end )
menu:AddOption( "Armor User", function() RunConsoleCommand( "say","!armor @ 100" ) end )
menu:AddOption( "Ban", function() RunConsoleCommand( "say","!ban @ 120" ) end )
menu:AddOption( "Kick", function() RunConsoleCommand( "say","!kick @" ) end )
menu:AddOption( "Strip", function() RunConsoleCommand( "say","!strip @" ) end )
menu:AddOption( "Jail", function() RunConsoleCommand( "say","!jail @ 120" ) end )
menu:AddOption( "Unjail", function() RunConsoleCommand( "say","!unjail @" ) end )
menu:AddOption( "Freeze", function() RunConsoleCommand( "say","!freeze @" ) end )
menu:AddOption( "Unfreeze", function() RunConsoleCommand( "say","!unfreeze @" ) end )
menu:AddOption( "Gag", function() RunConsoleCommand( "say","!gag @" ) end )
menu:AddOption( "Ungag", function() RunConsoleCommand( "say","!Ungag @" ) end )
menu:AddOption( "Mute", function() RunConsoleCommand( "say","!mute @" ) end )
menu:AddOption( "Unmute", function() RunConsoleCommand( "say","!unmute @" ) end )
menu:AddOption( "Close", function() print( "Close pressed" ) end ) -- The menu will remove itself, we don't have to do anything.
menu:Open()
_________________________________________________________________________________________________________________________________


Im attempting to make a quick menu and would love some help. i would also love help on how to make it so instead of opening lua file and it auto opens id like a console command to open the menu.
« Last Edit: June 25, 2015, 09:59:30 AM by BobTheDuck69 »
~The friendly neighborhood duckie~

Offline BobTheDuck69

  • Newbie
  • *
  • Posts: 33
  • Karma: 1
Re: ULX Clientside derma menu
« Reply #1 on: June 25, 2015, 09:56:13 AM »
--Update--

Ok so i found a way to do the commands. but i need a way to open the menu without having to run the file over and over.
~The friendly neighborhood duckie~

Offline JamminR

  • Ulysses Team Member
  • Hero Member
  • *****
  • Posts: 8096
  • Karma: 390
  • Sertafide Ulysses Jenius
    • Team Ulysses [ULib/ULX, other fine releases]
Re: ULX Clientside derma menu
« Reply #2 on: June 25, 2015, 07:49:37 PM »
You really need to learn lua function, and Gmod hook, ideology before jumping into GUI for any of it.
Pseudo code
Code: [Select]
function mydermamenu ( any, var )
...your code
end
hook.Add(<i forget>, uniquenameformyderma, mydermamenu)

In Gmod, there are 'hooks' and commands to monitor console and or chat.
Research chat hooks and console command to look for some command, then run that function to open the menu.

I really can't explain it more than that in the time I have.
Learn functions.
Learn Gmod console command or chat hooks.
Go from there.
"Though a program be but three lines long, someday it will have to be maintained." -- The Tao of Programming

An Error Has Occurred!

array_keys(): Argument #1 ($array) must be of type array, null given