G.RunConsoleCommand
From GMod Wiki
Function | |
Syntax |
RunConsoleCommand( String Command [, String argument 1, String argument 2, ...] ) Where is this used? |
Description: | |
Runs a console command on the server or client. | |
Returns: | nil |
Part of Library: | Global Functions |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=G.RunConsoleCommand]G.RunConsoleCommand [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | This example turns on the net graph. |
---|---|
Used on | |
Code | RunConsoleCommand("net_graph", "3"); |
Output | N/A |
Description | This Example makes the airaccelerate to 100. |
---|---|
Used on | |
Code | RunConsoleCommand("sv_airaccelerate", "100"); |
Output | N/A |
Additional Notes
- Arguments are optional.
- Decimal arguments are best converted to strings using tostring().
- If you are wanting to run a console command client-side, use this function. Otherwise use Player.ConCommand on the server.
- This function replaces LocalPlayer():ConCommand().
- Any command with "ent_" is blocked.
- The following commands are blocked:
"con_enable" "sv_cheats", "_restart", "exec", "condump", "connect", "bind", "BindToggle", "alias", "ent_fire", "ent_setname", "sensitivity", "name", "r_aspect", "quit", "exit", "lua_run", "lua_run_cl", "lua_open", "lua_cookieclear", "lua_showerrors_cl", "lua_showerrors_sv", "lua_openscript", "lua_openscript_cl", "lua_redownload", "sent_reload", "sent_reload_cl", "swep_reload", "swep_reload_cl", "gamemode_reload", "gamemode_reload_cl", "con_logfile", "clear", "rcon_password", "test_RandomChance", "plugin_load",