Player.ConCommand
From GMod Wiki
Function | |
Syntax | Player:ConCommand( String command ) |
Description: | |
Executes the passed string as a console command. | |
Returns: | nil |
In Object: | Player |
Realm: | |
BBCode Link: | [b][url=http://wiki.garrysmod.com/?title=Player.ConCommand]Player.ConCommand [img]http://wiki.garrysmod.com/favicon.ico[/img][/url][/b] |
Examples
Description | This will make all players disconnect. |
---|---|
Used on | |
Code | for k,v in pairs(player.GetAll()) do v:ConCommand("disconnect") end |
Output | N/A |
Additional Notes
- This is nearly equivilent to a player typing the given command in his own console. It can run functions created by both the server and the client.
- When running this binding in a clientside script, it can only tell LocalPlayer() to run clientcommands (assumed).
- You should not use ConCommand on LocalPlayer() as it is deprecated. You should instead use the RunConsoleCommand() global function.