Quote:
Originally Posted by Popoklopsi
Hm i compiled the usermessages (given with dota2) with the protoc compiler (See attachment)
Then i builded the Protobuf lib and linked against it.
After that i added
PHP Code:
#include "usermessages.pb.h"
and finally added:
PHP Code:
#if defined GAME_CSGO
MRecipientFilter filter;
filter.AddAllPlayers();
CUserMsg_SayText text;
text.set_client((google::protobuf::uint32)pEntity);
text.set_chat(true);
text.set_text("WUI TESTING");
engine->SendUserMessage(filter, UM_SayText, text);
#endif
In the compiled proto files, there you have a enum of all Usermessages types, like here: UM_SayText
|
Yes, we've been able to do that as well since shortly after the update.
Zephyrus is talking about dynamically mapping the names (like "SayText2", or even "UM_SayText2") to then dynamically create a message.
We can actually already do this now with only a slight bit of hackery (comparing message type names in the file descriptor to the names in the enum descriptor). It then is still a matter of porting into the existing usermessage api. As I explained a page or two ago, you cannot just directly write data in. It needs to be correctly mapped to a field, either by index or name, unlike the old message which were just direct bitbuffers.