Garry's Mod Wiki


  game.ConsoleCommand( string stringCommand )


Runs a console command. Make sure to add a newline ("\n") at the end of the command.

If you use data that were received from a client, you should avoid using this function because newline and semicolon (at least) allow the client to run arbitrary commands!

For safety, you are urged to prefer using RunConsoleCommand in this case.


1 string stringCommand
String containing the command and arguments to be ran.


Changes the gravity to 400 (default 600).

game.ConsoleCommand("sv_gravity 400\n")