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

Point servercommand: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
m (categorising)
No edit summary
 
(24 intermediate revisions by 12 users not shown)
Line 1: Line 1:
{{toc-right}}
{{LanguageBar}}
__NOTOC__
{{CD|CPointServerCommand|file1=client.cpp}}
{{this is a|logical entity|name=point_servercommand}} It issues commands to the server console. It's used by simply placing it in a map and triggering the Command input, the parameter override should be the exact [[console command]] to run or [[console variable]] to change.{{confirm|Any ConCommands/ConVars that aren't cheat flagged or hidden can be used.}}  


{{base point|point_servercommand}} It issues commands to the server console. It's used by simply placing it in a map and triggering the Command input, the parameter override should be the exact console command to run.
{{note|Due to a high risk of abuse, it is gated by the <var>sv_allow_point_servercommand</var> console variable.}}
 
{{note|In {{gmod|4}} , due to abuse, the [[point_servercommand]] and [[point_clientcommand]] is removed.{{workaround|Use [[lua_run]] {{code|RunConsoleCommand('command')}} }}}}
{{warning|'''This entity can corrupt the vmf file if used improperly.''' If your map crashes when you open it, this could be the problem. Open the vmf file in notepad and press Ctrl+F. Search for command and remove that line.
 
One way in which this entity can become corrupted is by enclosing commands that contain spaces in quotation marks. In some other contexts this is necessary to make sure the computer does not interpret a space as the end of the command, but here it will cause an immediate map crash on attempting to compile or open the map. The map can be repaired by removing the superfluous quotation marks in Notepad or with a tool such as PSPad. Attempting to open the map in [[Object Viewer]] may fail but yield a useful error message that gives the exact line of code to be edited, referred to as a "malformed expression."}}
 
{{in code|class=class_c_point_server_command.html CPointServerCommand|file=client_8cpp-source.html client.cpp}}


== Keyvalues ==
== Keyvalues ==
Line 13: Line 11:


== Inputs ==
== Inputs ==
{{IO|Command|Command to execute.|param=string}}
{{I|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 the string argument manually with a text editor.}}|param=string}}
{{I Targetname}}


== Outputs ==
== ConVars ==
{{O Targetname}}


== See Also ==
{{varcom|start}}
{{varcom|sv_allow_point_servercommand|"always"<br><br>{{tf2}} "official"
|string|Allow use of point_servercommand entities in map. Potentially dangerous for untrusted maps.
disallow : Always disallow<br>
official : Allowed for valve maps only {{tf2|only}}<br>
always  : Allow for all maps
}}
{{varcom|end}}


== See also ==
* [https://github.com/ValveSoftware/source-sdk-2013/blob/master/mp/src/game/server/client.cpp#L609 CPointServerCommand]
* [[point_broadcastclientcommand]]
* [[point_broadcastclientcommand]]
* [[point_clientcommand]]
* [[point_clientcommand]]
[[Category:Console Commands]]

Latest revision as of 02:06, 30 June 2025

English (en)中文 (zh)Translate (Translate)
C++ Class hierarchy
CPointServerCommand
CPointEntity
CBaseEntity
C++ client.cpp

point_servercommand is a logical entity available in all Source Source games. It issues commands to the server console. It's used by simply placing it in a map and triggering the Command input, the parameter override should be the exact console command to run or console variable to change.

Confirm:Any ConCommands/ConVars that aren't cheat flagged or hidden can be used.
Note.pngNote:Due to a high risk of abuse, it is gated by the sv_allow_point_servercommand console variable.
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.
Icon-Bug.pngBug:In Hammer, using " symbol in parameter field will corrupt the VMF file's structure, making the file unviewable for the next Hammer session.  [todo tested in ?]
Note.pngFix:Remove the string argument manually with a text editor.

ConVars

Cvar/Command Parameters or default value Descriptor Effect
sv_allow_point_servercommand "always"

Team Fortress 2 "official"
string Allow use of point_servercommand entities in map. Potentially dangerous for untrusted maps.

disallow : Always disallow
official : Allowed for valve maps only (only in Team Fortress 2)
always  : Allow for all maps

See also