Client Command by trigger_proximity
This article needs to be cleaned up to conform to a higher standard of quality.
This page is a candidate for speedy deletion.
If you disagree with its speedy deletion, please explain why on its talk page. If this page obviously does not meet the criteria for speedy deletion, or you intend to fix it, please remove this notice, but do not remove this notice from articles that you have created yourself.
Sometimes, either for testing or gameplay purposes, you may need the client (player(s) on your map) to execute a console command. This tutorial explains how to make a console command which executes on the start of every round in CS:S and makes a single CT activate his flashlight. If you want things to be used multiple times, read at the end of this tutorial what you need to do.
- Player spawn. e.g. info_player_start, info_player_counterterrorist, info_player_terrorist, etc.
- Information about client commands: Command, Console Command List, and Impulse
Setting up the point_clientcommand
Note:It doesn't matter where you put it, but a sensible place might be near the player spawn so you don't lose it.
Setting up the trigger_proximity
Setting up the logic_auto
Note:IMPORTANT! Don't forget the wildcard (*)! This will automatically disable ALL trigger_proximity-entities after 5 seconds, so none of the other players executes the command, if the trigger_proximity was not fired.
For more triggers, like described in this tutorial, copy the point_clientcommand and the trigger_proximity. Rename them both to make sure they are only related to each other. Now place them at more player spawns.
|Player #||Name point_clientcommand||Name Trigger_proximity||Output Trigger_proximity|
|Player 1||clientcommand||triggerprox_1||clientcommand|Command|impulse 100|0.20|signed|
|Player 2||clientcommand||triggerprox_2||clientcommand|Command|impulse 100|0.20|signed|
Leave the logic_auto as it is, since it will automatically search for more triggerprox_ prefixes because of the wildcard (*).The clientcommand is still the same, because it will just execute the Client Command and does nothing else.
For multiple commands at a time, add more outputs to the trigger_proximity-entity:
|My output||Target entity||Target input||Parameter||Delay||Only once||Comments|
|OnUser1||clientcommand||Command||impulse 100||0.20||signed||Active the flashlight on Client's side|
|OnUser1||clientcommand||Command||jpeg||0.00||signed||Create a screenshot on Client's side|
Tips for commands
For this tutorial, a flashlight (impulse 100) was used as a command. There are many others that come in handy. Feel free to add your own suggestions (including the Console Command, circumstances):
|Command||What does it do||Circumstances / Examples|
||Toggles flashlight||Dark maps|
||Binds a key for a command||Binding a key to a certain command (only useful in Single Player).|
||Creates a command that makes automatic weapons into one shot weapons. Once this command has been executed, use another command to bind mouse1 to oneclick||Can be used to make using an assault rifle or machine gun more challenging (use in singleplayer for best results)|
ent_fire <ent_name> <message>) requires double quotes. This will crash Hammer next time you load the level, as Hammer uses double quotes to separate parts of messages. Currently the only way around this(to my knowledge) is to use double quotes when compiling, which will work fine, but when exiting Hammer change the double quotes to single quotes(then save). Next time you load the map, remember to change them back to double quotes.
sdk_client_command_start_round__by_CrabbyData.vmf (13,3 kB)