new post | browse code | authors | help | about

LuaBin 2.0

Viewing file root / lua / autorun / utilities_menu.lua

  1.  
  2. //
  3. // The server only runs this file so it can send it to the client
  4. //
  5.  
  6. if ( SERVER ) then AddCSLuaFile( "utilities_menu.lua" ) return end
  7.  
  8.  
  9. local function Undo( CPanel )
  10.  
  11.         CPanel:AddControl( "Header", { Text = "#Undo" }  )
  12.        
  13.         // The rest is added by the undo module dynamically
  14.        
  15. end
  16.  
  17. local function User_Cleanup( CPanel )
  18.  
  19.         CPanel:AddControl( "Header", { Text = "#Cleanup" }  )
  20.        
  21.         // The rest is added by the undo module dynamically
  22.        
  23. end
  24.  
  25. local function ServerSettings( CPanel )
  26.  
  27.         CPanel:AddControl( "Header", { Text = "#Server Settings" }  )
  28.                
  29.         CPanel:AddControl( "TextBox",   { Label = "#Server Password",                   Command = "sv_password",        WaitForEnter =  "1" }  )       
  30.        
  31.         // Not needed anymore
  32.         //CPanel:AddControl( "Button",  { Label = "#Enable/Disable AI",                 Command = "ai_disable",         Text = "Toggle" }  )   
  33.        
  34.         // sbox_maxnpcs 0
  35.         //CPanel:AddControl( "CheckBox",        { Label = "#Allow NPCs",                                Command = "sbox_allownpcs" }  )
  36.        
  37.         CPanel:AddControl( "CheckBox",  { Label = "#Allow Flying (Noclip)",             Command = "sbox_noclip" }  )   
  38.         CPanel:AddControl( "CheckBox",  { Label = "#Allow Weapons",                             Command = "sbox_weapons" }  )
  39.         CPanel:AddControl( "CheckBox",  { Label = "#God Mode",                                  Command = "sbox_godmode" }  )  
  40.         CPanel:AddControl( "CheckBox",  { Label = "#Enable PvP Damage",                 Command = "sbox_plpldamage" }  )       
  41.        
  42.         CPanel:AddControl( "Slider",    { Label = "#Gravity", Type = "Float",   Command = "sv_gravity",         Min = "-200",   Max = "600" }  )
  43.         CPanel:AddControl( "Slider",    { Label = "#Physics Timescale", Type = "Float",         Command = "phys_timescale",     Min = "0",      Max = "2" }  )
  44.         CPanel:AddControl( "Slider",    { Label = "#Physics Iterations", Type = "Integer",      Command = "gmod_physiterations",        Min = "1",      Max = "10" }  )
  45.        
  46. end
  47.  
  48.  
  49.        
  50. /*
  51. // Tool Menu
  52. */
  53. local function PopulateUtilityMenus()
  54.  
  55.         spawnmenu.AddToolMenuOption( "Utilities", "User",       "User_Cleanup", "#Cleanup",     "",     "",     User_Cleanup )
  56.         spawnmenu.AddToolMenuOption( "Utilities", "User",       "Undo",         "#Undo",                        "",     "",     Undo )
  57.        
  58.         spawnmenu.AddToolMenuOption( "Utilities", "Admin",      "Admin_Cleanup",        "#Cleanup",     "",     "",     User_Cleanup )
  59.         spawnmenu.AddToolMenuOption( "Utilities", "Admin",      "ServerSettings",       "#Settings",    "",     "",     ServerSettings )
  60.  
  61. end
  62.  
  63. hook.Add( "PopulateToolMenu", "PopulateUtilityMenus", PopulateUtilityMenus )
  64.  
  65. /*
  66. // Categories
  67. */
  68. local function CreateUtilitiesCategories()
  69.  
  70.         spawnmenu.AddToolCategory( "Utilities",         "User",         "#User" )
  71.         spawnmenu.AddToolCategory( "Utilities",         "Admin",        "#Admin" )
  72.  
  73. end    
  74.  
  75. hook.Add( "AddToolMenuCategories", "CreateUtilitiesCategories", CreateUtilitiesCategories )