CS:GO User Messages: Difference between revisions

From Valve Developer Community
Jump to navigation Jump to search
No edit summary
m (clean up, added orphan, deadend tags)
 
(One intermediate revision by one other user not shown)
Line 1: Line 1:
{{Multiple issues|
{{Dead end|date=January 2024}}
{{Orphan|date=January 2024}}
}}
===== User Messages in Counter-Strike: Global Offensive =====
===== User Messages in Counter-Strike: Global Offensive =====


User messages in CS:GO use Google's Protocol Buffers (protobuf). Protobuf is a message/object serialization language that generates code to serialize the objects efficiently. For information about protobuf, see https://developers.google.com/protocol-buffers/docs/overview
User messages in CS:GO use Google's Protocol Buffers (protobuf). Protobuf is a message/object serialization language that generates code to serialize the objects efficiently. For information about protobuf, see https://developers.google.com/protocol-buffers/docs/overview


On Windows, follow these steps to generate C++ classes from CS:GO .proto files.  
On Windows, follow these steps to generate C++ classes from CS:GO .proto files.


* Download and extract [http://media.steampowered.com/apps/csgo/dev/csgo_usermessages.zip csgo_usermessages.zip]  
* Download and extract [http://media.steampowered.com/apps/csgo/dev/csgo_usermessages.zip csgo_usermessages.zip]  
Line 13: Line 18:


CSingleUserRecipientFilter filter( this );<br />
CSingleUserRecipientFilter filter( this );<br />
filter.MakeReliable();<br />
filter.MakeReliable();


CCSUsrMsg_HintText msg;<br />
CCSUsrMsg_HintText msg;<br />
Line 19: Line 24:
SendUserMessage( filter, CS_UM_HintText, msg );<br /><br />
SendUserMessage( filter, CS_UM_HintText, msg );<br /><br />


 
[[Category:C++|User Messages]]
[[Category:C++]]
[[Category:Counter-Strike: Global Offensive|User Messages]]
 
[[Category:Counter-Strike: Global Offensive]]

Latest revision as of 08:50, 21 January 2024

Wikipedia - Letter.png
This article has multiple issues. Please help improve it or discuss these issues on the talk page. (Learn how and when to remove these template messages)
Dead End - Icon.png
This article has no Wikipedia icon links to other VDC articles. Please help improve this article by adding links Wikipedia icon that are relevant to the context within the existing text.
January 2024
User Messages in Counter-Strike: Global Offensive

User messages in CS:GO use Google's Protocol Buffers (protobuf). Protobuf is a message/object serialization language that generates code to serialize the objects efficiently. For information about protobuf, see https://developers.google.com/protocol-buffers/docs/overview

On Windows, follow these steps to generate C++ classes from CS:GO .proto files.

  • Download and extract csgo_usermessages.zip
  • Download the protocol buffer compiler protoc-2.3.0 and extract it into the protoc-2.3.0-win32 folder that was created when you extracted csgo_usermessages.zip. The protocol buffer compiler is required to generate C++ classes from CS:GO .proto files.
  • Download protobuf-2.3.0 and extract it into the same folder as csgo_usermessages.zip. This package contains files that are included by CS:GO .proto files
  • Run make_cc_files.bat. The generated C++ files are created in subdirectory named generated_proto.

You can now use the generated classes in your C++ code to send user messages. Here is an example of how to send the HintText message

CSingleUserRecipientFilter filter( this );
filter.MakeReliable();

CCSUsrMsg_HintText msg;
msg.set_text( "ExampleHint" );
SendUserMessage( filter, CS_UM_HintText, msg );