This article's documentation is for anything that uses the Source engine. Click here for more information.

Point clientcommand: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (→‎ConCommands: I think that's what that was supposed to say)
 
(38 intermediate revisions by 11 users not shown)
Line 1: Line 1:
__NOTOC__
{{CD|CPointClientCommand|file1=client.cpp}}
{{CD|CPointClientCommand|file1=client.cpp}}
{{base point|point_clientcommand}} It issues commands to the client console as if they were typed manually by the player. The client commands are sent as parameters of the ''Command'' [[input]]. One instance of the entity is ever needed in a map.
{{this is a|logical entity|name=point_clientcommand}} It issues commands to the client console as if they were typed manually by the player. The client commands are sent as parameters of the ''Command'' [[input]]. Only one instance of the entity is ever needed in a map.


In multiplayer games, the commands are only executed on the [[Activator]]'s client. If the activator was not a player, then it simply won't do anything (unless it's in commentary mode; then the command will be executed from the first player). If you require all players to execute the command, use the [[point_broadcastclientcommand]] entity instead.
In multiplayer games, the commands are only executed on the [[Activator]]'s client. If the activator was not a player, then it simply won't do anything (unless it's in commentary mode; then the command will be executed from the first player). If you require all players to execute the command, use the {{ent|point_broadcastclientcommand}} entity instead.


This command (in conjunction with [[point_servercommand]] and the config (cfg) file) used to allow a client to cheat on multiplayer servers through changing player names, execute client commands, and other things. On multiplayer servers, any command that DOES NOT HAVE the ''FCVAR_SERVER_CAN_EXECUTE'' flag set cannot be executed by this entity; any attempt will be reported and blocked.
This command (in conjunction with {{ent|point_servercommand}} and the config (cfg) file) used to allow a client to cheat on multiplayer servers through changing player names, execute client commands, and other things. On multiplayer servers, any command that DOES NOT HAVE the ''FCVAR_SERVER_CAN_EXECUTE'' flag set cannot be executed by this entity; any attempt will be reported to console and blocked.
{{note|In {{gmod|4}} , due to abuse, the <kbd>point_servercommand</kbd> and <kbd>point_clientcommand</kbd> is removed.{{workaround|Use [[lua_run]] {{code|RunConsoleCommand('command')}} }}}}
<onlyinclude>
<onlyinclude>
== Keyvalues ==
== Keyvalues ==
Line 11: Line 11:


== Inputs ==
== Inputs ==
{{IO|Command|Command to execute.{{Bugfix|In Hammer, using " symbol in parameter field will corrupt the [[VMF]] file's structure, making the file unviewable for the next Hammer session.|Remove additional " symbols manually with a text editor.}}|param=string}}
{{I|Command|param=string|Command to execute.}}
:{{Hammer quote warning}}


== Usable ConVars/ConCommands in multiplayer ==
== Commands usable on clients in multiplayer ==
{{note|In {{l4ds}} item equipping related commands only work when bound or used on human player with this entity}}


Following commands have "server_can_execute" flag.
Listed ConCommands and ConVars have "server_can_execute" flag.


=== ConCommands ===
=== ConCommands ===
Line 22: Line 22:
{{varcom|echo|<string>||Echo text to console.}}
{{varcom|echo|<string>||Echo text to console.}}
{{varcom|cancelselect|||In {{hl}} style hud cancels currently selected weapon}}
{{varcom|cancelselect|||In {{hl}} style hud cancels currently selected weapon}}
{{varcom|firstperson|||Go into firstperson view}}
{{varcom|invnext|||In {{hl}} style hud selects next weapon}}
{{varcom|invnext|||In {{hl}} style hud selects next weapon}}
{{varcom|invprev|||In {{hl}} style hud selects previous weapon}}
{{varcom|invprev|||In {{hl}} style hud selects previous weapon}}
{{varcom|lastinv|||Equips previously used weapon}}
{{varcom|lastinv|||Equips previously used weapon}}
{{varcom|{{only|{{tf2}}}}+inspect|||Force weapon inspection}}
{{varcom|{{only|{{tf2}}}}-inspect|||Cancel weapon inspection}}
{{varcom|slot0 - slot10|||In {{hl}} style hud selects slot with the given number}}
{{varcom|slot0 - slot10|||In {{hl}} style hud selects slot with the given number}}
{{varcom|{{only|{{l4d2}}}}cl_consistencycheck|||Triggers the client to perform a consistency check}}
{{varcom|{{only|{{l4d2}}}}cl_consistencycheck|||Triggers the client to perform a consistency check}}
Line 30: Line 33:
{{varcom|play|<string>|<sound path>|Play a sound.}}
{{varcom|play|<string>|<sound path>|Play a sound.}}
{{varcom|playgamesound|<string>|<soundscript>|Play a sound from the game sounds txt file}}
{{varcom|playgamesound|<string>|<soundscript>|Play a sound from the game sounds txt file}}
{{varcom|{{only|{{l4d2}}}}|snd_playsounds|<string> [<float> <float> <float>]|<soundscript> [<x> <y> <z>]|Play sounds from the game sounds txt file at a given location}}
{{varcom|soundfade|<float> <float> [<float> <float>]|<percent> <hold> [<out> <int>]|Fade in/out all client volume}}
{{varcom|sndplaydelay|<float> <string>|<delay_in_sec> <soundname>|Play a sound with a given delay. Negative to skip ahead}}
{{varcom|{{since|
{{l4d2}}}}snd_playsounds|<string> [<float> <float> <float>]|<soundscript> [<x> <y> <z>]|Play sounds from the game sounds txt file at a given location}}
{{varcom|snd_setsoundparam|<string> <volume <float 0.0-1.0> {{!}}level SNDLVL_<int 1-179>>|<soundscript> <volume <vol> {{!}}level SNDLVL_<db>>|Can change level or volume of a soundscript.
{{varcom|snd_setsoundparam|<string> <volume <float 0.0-1.0> {{!}}level SNDLVL_<int 1-179>>|<soundscript> <volume <vol> {{!}}level SNDLVL_<db>>|Can change level or volume of a soundscript.
<br>examples: <code>snd_setsoundparam Flaregun.Detonate volume 0.1</code><br><code>snd_setsoundparam Flaregun.Detonate level SNDLVL_120</code>}}
<br>examples: <code>snd_setsoundparam Flaregun.Detonate volume 0.1</code><br><code>snd_setsoundparam Flaregun.Detonate level SNDLVL_120</code>}}
{{varcom|retry|||Retry connection to last server.}}
{{varcom|redirect|<string>|<server ip address>|Redirect client to specified server. {{note|In {{tf2}}, the client must have the server favorited in the server browser for this to work. {{confirm|Is this the case for all {{tf2branch}} games?}} }}}}
{{varcom|retry|||Retry connection to current (or last) server.}}
{{varcom|rpt_connect|||}}
{{varcom|rpt_connect|||}}
{{varcom|r_screenoverlay {{bug|Cannot be used without sv_cheats 1 in {{l4d2}}<br>{{todo|confirm other games}}}}|<string>|<material name>|Draw specified material as an overlay}}
{{varcom|r_cleardecals|||Clear all client decals}}
{{varcom|r_screenoverlay|<string>|<material name>|Draw specified material as a screen overlay{{bug|Cannot be used without sv_cheats 1 in {{l4d2}}<br>In other games, this command will only work without cheats but ONLY on [[Dedicated server|dedicated servers]]. <br>In {{tf2}}, use the <code>SetScriptOverlayMaterial</code> input on players instead.}}}}
{{varcom|+remote_view / -remote_view {{portal2}}|||}}
{{varcom|+leaderboard / -leaderboard {{portal2}}|||Display/hide in game leaderboard}}
{{varcom|playvideo_nointerrupt {{portal2}}||<filename> [width height]|Plays a video without ability to skip}}
{{varcom|playvideo_end_level_transition {{portal2}}||<filename> <time>|Plays a video fullscreen without ability to skip (unless dev 1) and fades in}}
{{varcom|playvideo_exitcommand {{portal2}}||<filename> <exit command>|Plays a video and fires an exit command when it is stopped or finishes}}
{{varcom|playvideo_exitcommand_nointerrupt {{portal2}}||<filename> <exit command>|Plays a video (without interruption) and fires an exit command when it is stopped or finishes}}
{{varcom|stop_transition_videos_fadeout {{portal2}}||<time>|Fades out all transition videos playing to the screen}}
{{varcom|rd_loc_reload {{asrd}}|||reload localization files}}
{{varcom|end}}
{{varcom|end}}


=== ConVars ===
=== ConVars ===
{{varcom|start}}
{{varcom|start}}
{{varcom|{{only|{{l4ds}}}}cl_ideal_spec_mode|5||desired spectator mode (4 {{=}} in-eye, 5 {{=}} chase, 6 {{=}} roaming)}}
{{varcom|cl_ideal_spec_mode {{l4ds}}|5||desired spectator mode (4 {{=}} in-eye, 5 {{=}} chase, 6 {{=}} roaming)}}
{{varcom|cl_session| ||}}
{{varcom|cl_spec_mode{{l4ds|not}}|||spectator mode}}
{{varcom|cl_spec_mode {{csgo}}|||Saves the last viewed spectator mode for use next time we start to spectate}} <!-- differing description and default -->
{{varcom|cl_session|""||}}
{{varcom|dsp_player|0||}}
{{varcom|dsp_player|0||}}
{{varcom|name|step||Current user name}}
{{varcom|name|unnamed||Current user name}}
{{varcom|name2|unnamed||Current user name}}
{{varcom|name2|unnamed||Current user name}}
{{varcom|r_flashlightbrightness{{portal2}}|0.25||}}
{{varcom|end}}
{{varcom|end}}
=== <tt>player</tt> class commands ===
Some commands are [https://github.com/ValveSoftware/source-sdk-2013/blob/ba5fe6853dd983f41b29106f2a41db7d885ae10f/src/game/server/player.cpp#L6499 defined in player class] and are completely hidden from auto complete. Such commands are also usable on clients connected to server via this entity
{{todo|list [[ClientCommand|commands defined in player class]] which don't require sv_cheats 1 [[Talk:List of Left 4 Dead 2 console commands and variables|(some examples from l4d2)]]}}
</onlyinclude>
</onlyinclude>
{{todo|Only {{l4d2}} cvar list was considered so add commands from other games if there are}}


== See also ==
== See also ==
* [[Unlocking chapters in your mod]]
* [[Unlocking chapters in your mod]]
* [[point_broadcastclientcommand]]
* {{ent|point_broadcastclientcommand}}
* [[point_servercommand]]
* {{ent|point_servercommand}}
 
[[Category:Console Commands]]

Latest revision as of 08:11, 13 May 2025

C++ Class hierarchy
CPointClientCommand
CPointEntity
CBaseEntity
C++ client.cpp

point_clientcommand is a logical entity available in all Source Source games. It issues commands to the client console as if they were typed manually by the player. The client commands are sent as parameters of the Command input. Only one instance of the entity is ever needed in a map.

In multiplayer games, the commands are only executed on the Activator's client. If the activator was not a player, then it simply won't do anything (unless it's in commentary mode; then the command will be executed from the first player). If you require all players to execute the command, use the point_broadcastclientcommand entity instead.

This command (in conjunction with point_servercommand and the config (cfg) file) used to allow a client to cheat on multiplayer servers through changing player names, execute client commands, and other things. On multiplayer servers, any command that DOES NOT HAVE the FCVAR_SERVER_CAN_EXECUTE flag set cannot be executed by this entity; any attempt will be reported to console and blocked.

Note.pngNote:In Garry's Mod Garry's Mod , due to abuse, the point_servercommand and point_clientcommand is removed.
PlacementTip.pngWorkaround:Use lua_run RunConsoleCommand('command')

Keyvalues

Name (targetname) <string>[ Edit ]
The name that other entities refer to this entity by, via Inputs/Outputs or other keyvalues (e.g. parentname or target).
Also displayed in Hammer's 2D views and Entity Report.
See also:  Generic Keyvalues, Inputs and Outputs available to all entities

Inputs

Command <stringRedirectInput/string>
Command to execute.
Warning.pngWarning:Using the quote symbol " in any text field of a Hammer Object Properties Dialog will lead to VMF corruption, fixable only by editing the VMF directly with a text editor and removing the added quote symbol.

Commands usable on clients in multiplayer

Listed ConCommands and ConVars have "server_can_execute" flag.

ConCommands

Cvar/Command Parameters or default value Descriptor Effect
echo <string> Echo text to console.
cancelselect In Half-Life style hud cancels currently selected weapon
firstperson Go into firstperson view
invnext In Half-Life style hud selects next weapon
invprev In Half-Life style hud selects previous weapon
lastinv Equips previously used weapon
(only in Team Fortress 2)+inspect Force weapon inspection
(only in Team Fortress 2)-inspect Cancel weapon inspection
slot0 - slot10 In Half-Life style hud selects slot with the given number
(only in Left 4 Dead 2)cl_consistencycheck Triggers the client to perform a consistency check
cl_soundscape_flush Flushes the client side soundscapes
play <string> <sound path> Play a sound.
playgamesound <string> <soundscript> Play a sound from the game sounds txt file
soundfade <float> <float> [<float> <float>] <percent> <hold> [<out> <int>] Fade in/out all client volume
sndplaydelay <float> <string> <delay_in_sec> <soundname> Play a sound with a given delay. Negative to skip ahead
(in all games since Left 4 Dead 2)snd_playsounds <string> [<float> <float> <float>] <soundscript> [<x> <y> <z>] Play sounds from the game sounds txt file at a given location
snd_setsoundparam <string> <volume <float 0.0-1.0> |level SNDLVL_<int 1-179>> <soundscript> <volume <vol> |level SNDLVL_<db>> Can change level or volume of a soundscript.
examples: snd_setsoundparam Flaregun.Detonate volume 0.1
snd_setsoundparam Flaregun.Detonate level SNDLVL_120
redirect <string> <server ip address> Redirect client to specified server.
Note.pngNote:In Team Fortress 2, the client must have the server favorited in the server browser for this to work.
Confirm:Is this the case for all Team Fortress 2 branch games?
retry Retry connection to current (or last) server.
rpt_connect
r_cleardecals Clear all client decals
r_screenoverlay <string> <material name> Draw specified material as a screen overlay
Icon-Bug.pngBug:Cannot be used without sv_cheats 1 in Left 4 Dead 2
In other games, this command will only work without cheats but ONLY on dedicated servers.
In Team Fortress 2, use the SetScriptOverlayMaterial input on players instead.  [todo tested in ?]
+remote_view / -remote_view Portal 2
+leaderboard / -leaderboard Portal 2 Display/hide in game leaderboard
playvideo_nointerrupt Portal 2 <filename> [width height] Plays a video without ability to skip
playvideo_end_level_transition Portal 2 <filename> Plays a video fullscreen without ability to skip (unless dev 1) and fades in
playvideo_exitcommand Portal 2 <filename> <exit command> Plays a video and fires an exit command when it is stopped or finishes
playvideo_exitcommand_nointerrupt Portal 2 <filename> <exit command> Plays a video (without interruption) and fires an exit command when it is stopped or finishes
stop_transition_videos_fadeout Portal 2 Fades out all transition videos playing to the screen
rd_loc_reload Alien Swarm: Reactive Drop reload localization files

ConVars

Cvar/Command Parameters or default value Descriptor Effect
cl_ideal_spec_mode Left 4 Dead seriesLeft 4 Dead series 5 desired spectator mode (4 = in-eye, 5 = chase, 6 = roaming)
cl_spec_mode(not in Left 4 Dead seriesLeft 4 Dead series) spectator mode
cl_spec_mode Counter-Strike: Global Offensive Saves the last viewed spectator mode for use next time we start to spectate
cl_session ""
dsp_player 0
name unnamed Current user name
name2 unnamed Current user name
r_flashlightbrightnessPortal 2 0.25

player class commands

Some commands are defined in player class and are completely hidden from auto complete. Such commands are also usable on clients connected to server via this entity

Todo: list commands defined in player class which don't require sv_cheats 1 (some examples from l4d2)


See also