Raised This Month: $75 Target: $400
 18% 

old "SayText" in CSGO


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Old and Slow
Senior Member
Join Date: May 2005
Location: Arlington, Texas
Old 07-14-2019 , 19:31   old "SayText" in CSGO
Reply With Quote #1

I have a plugin that, once upon a time, worked in both CSS and CSGO with minor logic to handle both. I think that CSGO now uses a newer engine and SDK, so there must be something equivalent for it. I have not had any luck finding it.

Could anybody enlighten me as to what it is?

Thanks!
__________________
.......Chuck |TxA| Old and Slow [AARP]
Old and Slow is offline
asherkin
SourceMod Developer
Join Date: Aug 2009
Location: OnGameFrame()
Old 07-15-2019 , 09:01   Re: old "SayText" in CSGO
Reply With Quote #2

CS:GO uses protobuf for usermessages, if your current code is from before that switch (Jan 2013) it is going to be a lot of work to migrate.

https://mxr.alliedmods.net/sourcemod...fLife2.cpp#502
__________________
asherkin is offline
Old and Slow
Senior Member
Join Date: May 2005
Location: Arlington, Texas
Old 07-15-2019 , 12:02   Re: old "SayText" in CSGO
Reply With Quote #3

I can't remember the last time it ran but it was probably before then.
Any links to some example code, similar to the Sample and Stub code?

Thanks for the sourcemod link - that may be good to look at.
__________________
.......Chuck |TxA| Old and Slow [AARP]
Old and Slow is offline
TheDS1337
Veteran Member
Join Date: Jun 2012
Old 07-25-2019 , 13:58   Re: old "SayText" in CSGO
Reply With Quote #4

If you're doing it for an SM extension then you can take advantage of the Usermessages interface. if it's for mms, then I'm afraid you'll have to go all around it yourself (you can always see how it's done in SM ofcourse), here's an example code:
HTML Code:
void UM_SayText(int *clients, int clientsCount, int author, bool addTag, const char *input)
{
	if( !input  )
	{
		return;
	}

	static int msgId = -1;

	if( msgId == -1 )
	{
		msgId = usermsgs->GetMessageIndex("SayText2");
	}

	CCSUsrMsg_SayText2 *msg = (CCSUsrMsg_SayText2 *) usermsgs->StartProtobufMessage(msgId, clients, 1, USERMSG_RELIABLE | USERMSG_BLOCKHOOKS);

	if( msg )
	{
		// Colors
		//	x01		->		default (white)
		//	x03		->		team (blue or orange)
		//	x04		->		green
		//	x05		->		olive
		//	x07%s	->		RRGGBB
		//	x08%s	->		RRGGBBAA

		static char buffer[1024];

		if( addTag )
		{
			ke::SafeSprintf(buffer, sizeof(buffer), "\x01 \x04[\x03%s\x04] \x01%s", g_pGameMod->GetTag(), input);
		}
		else
		{
			ke::SafeSprintf(buffer, sizeof(buffer), "\x01 \x01%s", input);
		}

		msg->set_ent_idx(author);
		msg->set_chat(true);
		msg->set_msg_name(buffer);

		const google::protobuf::FieldDescriptor *field = msg->GetDescriptor()->FindFieldByName("params");

		if( field )
		{
			msg->GetReflection()->AddString(msg, field, "");
			msg->GetReflection()->AddString(msg, field, "");
			msg->GetReflection()->AddString(msg, field, "");
			msg->GetReflection()->AddString(msg, field, "");
		}
	
		usermsgs->EndMessage();		
	}
}

NOTE: you'll have to link the libprotobuf.lib/a file, and you'll also need to include some additional source and header files for the linking to work, all of this can be found on the HL2SDK for CSGO, provided by the AlliedModders team. for the source files you can just need these:
Code:
public/engine/protobuf/netmessages.pb.cc 
public/game/shared/csgo/protobuf/cstrike15_usermessages.pb.cc
public/game/shared/csgo/protobuf/cstrike15_usermessage_helpers.cpp
Also, for winows you'll have to compile libprotobuf yourself.

For useful info on the matter, check this out: https://wiki.alliedmods.net/Compiling_libprotobuf

Last edited by TheDS1337; 07-25-2019 at 14:01.
TheDS1337 is offline
Send a message via MSN to TheDS1337
Old and Slow
Senior Member
Join Date: May 2005
Location: Arlington, Texas
Old 08-01-2019 , 16:38   Re: old "SayText" in CSGO
Reply With Quote #5

Thanks - sorry for the late reply (got sidetracked on something else)
I had peeked at the sourcemod implementation - I just need to dig into it deeper.
__________________
.......Chuck |TxA| Old and Slow [AARP]
Old and Slow is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 03:37.


Powered by vBulletin®
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Theme made by Freecode