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

Point broadcastclientcommand: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
(This entity doesn't exist in TF2)
Tag: Manual revert
 
(5 intermediate revisions by 2 users not shown)
Line 1: Line 1:
__NOTOC__
__NOTOC__
{{CD|CPointBroadcastClientCommand|file1=client.cpp}}
{{CD|CPointBroadcastClientCommand|file1=client.cpp}}
{{this is a|point entity|name=point_broadcastclientcommand|since=Left 4 Dead}} It's an entity that issues commands to each valid client's console, as if it was typed in by that player locally.  
{{this is a|logical entity|name=point_broadcastclientcommand|since=Left 4 Dead}} It's an entity that issues commands to each valid client's console, as if it was typed in by that player locally.  
{{tip|In {{tf2}}, you can use the following entity I/O to send a client command to all players using [[point_clientcommand]].  This will not work if you have more than one entity!
{{tip|In other [[VScript]] supported titles where this entity is not available, you can use the following [[Entity Scripts|entity script]] inside a {{ent|point_clientcommand}}
{{code|player RunScriptCode  Entities.FindByClassname(null, `point_clientcommand`).AcceptInput(`Command`, `console_command_here`, self, self)}}
<syntaxhighlight lang=js>function BroadcastCommand(command) {
{{todo|This can probably be done in other [[VScript]] supported titles by using {{hammerplusplus}} and escaping the quotes into the vmf file before compiling but not confirmed.  {{tf2}} supports backticks so it's not necessary here.}}
    for(local player; player = Entities.FindByClassname(player, "player"); ) {
        EntFire("!self", "Command", command, 0, player);
    }
}</syntaxhighlight>
and run the function via
<code>clientcommand_name RunScriptCode BroadcastCommand(`console_command_here`)</code>
}}
}}


{{:point_clientcommand}}
== Keyvalues ==
{{KV Targetname}}
{{OtherKIO|point_clientcommand|All usable commands and}}


== See also ==
== See also ==
* {{ent|point_clientcommand}}
* {{ent|point_clientcommand}}
* {{ent|point_servercommand}}
* {{ent|point_servercommand}}

Latest revision as of 05:01, 13 May 2025

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

point_broadcastclientcommand is a logical entity available in all Source Source games since Left 4 Dead Left 4 Dead. It's an entity that issues commands to each valid client's console, as if it was typed in by that player locally.

Tip.pngTip:In other VScript supported titles where this entity is not available, you can use the following entity script inside a point_clientcommand
function BroadcastCommand(command) {
    for(local player; player = Entities.FindByClassname(player, "player"); ) {
        EntFire("!self", "Command", command, 0, player);
    }
}

and run the function via clientcommand_name RunScriptCode BroadcastCommand(`console_command_here`)

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

Note.pngNote:All usable commands and Keyvalues / Inputs / Outputs are same as point_clientcommand.

See also