Garry's Mod
Garry's Mod

Running Simple Console Commands with Lua

Run simple console commands with Lua in Garry's Mod. Automate actions like saving cannons or triggering dances with custom commands and optimization techniques.

Running Simple Console Commands with Lua

Garry's Mod, built on the Source engine, supports console commands for various tasks, including performance optimization and gameplay adjustments. Players can enable the developer console to input commands directly. For more advanced functionalities, Lua scripting can be used to create custom commands or automate actions, such as saving cannon configurations or triggering specific dances.

Enabling the Developer Console

To access console commands, first enable the developer console:

  1. Launch Garry's Mod.
  2. From the main menu, select Options.
  3. Go to the Keyboard tab.
  4. Click the Advanced button.
  5. Check the box next to Enable developer console (~).
  6. Click Apply.

Press the ~ key to open the console. Some commands may require enabling sv_cheats 1 first. Be aware that many servers disable cheats or prevent play with them enabled.

Optimizing Framerate with Console Commands

Improve your Garry's Mod framerate without installing additional mods by modifying the autoexec.cfg file and using launch options:

  1. Locate your garrysmod/cfg folder.
  2. Open autoexec.cfg with a text editor (e.g., Notepad).
  3. Paste the following code into the file:gmod_mcore_test 1
    mat_queue_mode 2
    cl_threaded_bone_setup 1
    cl_threaded_client_leaf_system 1
    r_threaded_client_shadow_manager 1
    r_threaded_particles 1
    r_threaded_renderables 1
    r_queued_ropes 1
    studio_queue_mode 1
    mat_specular 1
    fps_max FRAMERATE
    menu_cleanupgmas
    host_writeconfig
  4. Replace FRAMERATE with your monitor's refresh rate for optimal results.
  5. Save the file.
  6. Open Garry's Mod properties in Steam.
  7. Navigate to the General section.
  8. In the Launch Options box, paste: +exec autoexec.cfg

Launch the game using the 64-Bit or Garry's Mod option to apply these settings.

Lua Scripting Examples

  • Confetti Cannons: Players with allowedRanks defined in confettycannon_config.lua can type !savecannons to save all cannons on the server with a defined interval.
  • Custom Taunts/Dances: Commands can be used to trigger specific dances or emotes, including 26 full MMD/anime dances, 45 MMD short dances, and 277 original Fortnite emotes, supporting Garry's Mod female and male skeletons.
  • Aimbot Gun: A Lua-based Aimbot Gun addon allows players to shoot heads and potentially lock onto other players.