Raised This Month: $ Target: $400
 0% 

Move Chat To Fix [CS:GO] Colors


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Azerja12
Senior Member
Join Date: Feb 2013
Location: EU
Old 04-02-2015 , 07:12   Move Chat To Fix [CS:GO] Colors
Reply With Quote #1

How to fix some plugin colors CS:GO allows:

By moving the chat or having something infront of it let's colors work properly for some reason. By having a space infront of all chat text will fix this.
I don't want the chat moved, i just want text in form of spaces infront of it by default on all messages. If it's possible to make or work when i message goes over one line that would be great also.
Examples:


Normal chat:
Code:
Hey
What's up?
Not much
What i want:
Code:

 Hey
 What's up?
 Not much
A message with much text (The colors would still work on the next line but it looks rubish):
Code:
 Hey
 Hey man, i've heard you were talking
to this one chick. What's up?
 Not much
Note:
This may not work in all circumstances but many of plugins that have colors in them won't show without this.
I know this for a fact because i've tested it with multiple plugins that allows me to have several prefixes. I added a prefix with a color and a space.

Let's say i added [Admin] but in green.
The colors would'nt show up without it. If i then added a another prefix it would not have color but the [Admin] would. Then by adding another with only a space everything would work propetly.

FAQ:
Why don't i just give all players a prefix?
If i have a plugin that displays chat messages the colors would not work propely.
This plugin need to work for whatever is displayed in chat.
__________________

Last edited by Azerja12; 04-02-2015 at 07:17. Reason: Grammar ETC
Azerja12 is offline
Azerja12
Senior Member
Join Date: Feb 2013
Location: EU
Old 04-03-2015 , 19:47   Re: Move Chat To Fix [CS:GO] Colors
Reply With Quote #2

Nothing?
__________________
Azerja12 is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 04-03-2015 , 20:08   Re: Move Chat To Fix [CS:GO] Colors
Reply With Quote #3

nothing.
LambdaLambda is offline
Azerja12
Senior Member
Join Date: Feb 2013
Location: EU
Old 04-04-2015 , 12:56   Re: Move Chat To Fix [CS:GO] Colors
Reply With Quote #4

Quote:
Originally Posted by LambdaLambda View Post
nothing.
Am i wrong?
Is there anything out there?
__________________
Azerja12 is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 04-04-2015 , 13:14   Re: Move Chat To Fix [CS:GO] Colors
Reply With Quote #5

Code:
public OnPluginStart()
{
	HookUserMessage(GetUserMessageId("SayText2"), OnSayText2, true);
}

public Action:OnSayText2(UserMsg:msg_id, Handle:bf, const clients[], iNumClients, bool:bReliable, bool:bInit) //parts of this function is borrowed from SCP
{
	new bool:bProtobuf = (CanTestFeatures() && GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf);

	decl String:sMsg[128];
	if(bProtobuf)
	{
		PbReadString(bf, "params", sMsg, sizeof(sMsg), 1);
		Format(sMsg, sizeof(sMsg), " %s", sMsg);
		PbSetString(bf, "params", sMsg, 1);
	}

	return Plugin_Changed;
}
Try something along those lines. If you want to format non-protobuf msgs, you'll have to grab the chat bool, translation name, name, and msg, the reparse them as a translation while adding your space in the msg., then pass it back with:
Code:
		BfWriteByte(bf, client);
		BfWriteByte(bf, bChat);
		BfWriteString(bf, sTranslation);
__________________
ThatOneGuy is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 04-04-2015 , 14:54   Re: Move Chat To Fix [CS:GO] Colors
Reply With Quote #6

CS:GO does not support Bf. Use Protobuf instead.
LambdaLambda is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 04-04-2015 , 15:08   Re: Move Chat To Fix [CS:GO] Colors
Reply With Quote #7

Quote:
Originally Posted by LambdaLambda View Post
CS:GO does not support Bf. Use Protobuf instead.
If you read the post, the first section of code provided IS protobuf. I said the other for if they want to do the same for other stuff. Read closer next time.
__________________
ThatOneGuy is offline
LambdaLambda
AlliedModders Donor
Join Date: Oct 2010
Location: London
Old 04-04-2015 , 15:12   Re: Move Chat To Fix [CS:GO] Colors
Reply With Quote #8

What's the point of that, then?
LambdaLambda is offline
ThatOneGuy
Veteran Member
Join Date: Jul 2012
Location: Oregon, USA
Old 04-04-2015 , 15:16   Re: Move Chat To Fix [CS:GO] Colors
Reply With Quote #9

Quote:
Originally Posted by LambdaLambda View Post
What's the point of that, then?
In case the OP or anyone in the future needs to edit msgs in a similar manner for any other game. Might as well provide a foundation for them on how they would do it.
__________________
ThatOneGuy is offline
Azerja12
Senior Member
Join Date: Feb 2013
Location: EU
Old 04-04-2015 , 18:54   Re: Move Chat To Fix [CS:GO] Colors
Reply With Quote #10

Quote:
Originally Posted by ThatOneGuy View Post
Code:
public OnPluginStart()
{
	HookUserMessage(GetUserMessageId("SayText2"), OnSayText2, true);
}

public Action:OnSayText2(UserMsg:msg_id, Handle:bf, const clients[], iNumClients, bool:bReliable, bool:bInit) //parts of this function is borrowed from SCP
{
	new bool:bProtobuf = (CanTestFeatures() && GetFeatureStatus(FeatureType_Native, "GetUserMessageType") == FeatureStatus_Available && GetUserMessageType() == UM_Protobuf);

	decl String:sMsg[128];
	if(bProtobuf)
	{
		PbReadString(bf, "params", sMsg, sizeof(sMsg), 1);
		Format(sMsg, sizeof(sMsg), " %s", sMsg);
		PbSetString(bf, "params", sMsg, 1);
	}

	return Plugin_Changed;
}
Try something along those lines. If you want to format non-protobuf msgs, you'll have to grab the chat bool, translation name, name, and msg, the reparse them as a translation while adding your space in the msg., then pass it back with:
Code:
		BfWriteByte(bf, client);
		BfWriteByte(bf, bChat);
		BfWriteString(bf, sTranslation);
Works great.

Thanks alot!
__________________
Azerja12 is offline
Reply



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 13:37.


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