Garry's Mod Wiki

Player:RunConsoleCommand

  Player:RunConsoleCommand( string command, ... )

Recently Added

This was recently added in version (2026.10.26). It might only be available on the Dev Branch right now.

Description

Runs given console command on the player. This does not work on bots.

See RunConsoleCommand for running console commands in the client realm instead.

Some commands/convars are blocked from being run/changed using this function, usually to prevent harm/annoyance to clients. For a list of blocked commands, see Blocked ConCommands.

Arguments

1 string command
The console command to run on the player.
2 vararg arguments
The arguments. You must pass each argument as a separate string argument.

Example

Sets a clientside only variable on the player.

Entity( 1 ):RunConsoleCommand( "my_fancy_variable", "my_fancy_value" )