Garry's Mod Wiki

Revision Difference

Player:RunConsoleCommand#568543

<function name="RunConsoleCommand" parent="Player" type="classfunc">⤶ <added>2026.10.26</added>⤶ <description>⤶ Runs given <page text="console command">Console_commands</page> on the player. This does not work on bots.⤶ ⤶ See <page>Global.RunConsoleCommand</page> for running console commands in the client realm instead.⤶ ⤶ <note>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 <page>Blocked ConCommands</page>.</note>⤶ </description>⤶ <realm>Server</realm>⤶ <args>⤶ <arg name="command" type="string">The console command to run on the player.</arg>⤶ <arg name="arguments" type="vararg">The arguments. You must pass each argument as a separate string argument.</arg>⤶ </args>⤶ </function>⤶ ⤶ <example>⤶ <description>Sets a clientside only variable on the player.</description>⤶ <code>Entity( 1 ):RunConsoleCommand( "my_fancy_variable", "my_fancy_value" )</code>⤶ </example>