Raised This Month: $12 Target: $400
 3% 

SayText colored message


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-25-2019 , 11:02   SayText colored message
Reply With Quote #1

Hello, I did this code to set green color in say messages, it works well only if player is dead, if alive just outputs a yellow message as default with a extra "space" at the beginning of the message (probably due of the color code). Does anyone know how to fix?

Code:
public CmdSay(this)
{
	if (!(get_user_flags(this) & (VIP_VIP|VIP_SUPER)))
		return PLUGIN_CONTINUE;

	new szFormat[32], szText[192];
	new bool:bIsAlive;

	read_args(szText, charsmax(szText));
	remove_quotes(szText);

	//server_print("szBuffer = %s", szBuffer)
	//trim(szBuffer);
	//szBuffer[190] = 0;

	if (!szText[0] || szText[0] == '/')
		return PLUGIN_CONTINUE;

	bIsAlive = bool:is_user_alive(this);

	if (!bIsAlive)
	{
		if (!(CS_TEAM_T <= cs_get_user_team(this) <= CS_TEAM_CT))
			copy(szFormat, charsmax(szFormat), "#Cstrike_Chat_AllSpec");
		else
			copy(szFormat, charsmax(szFormat), "#Cstrike_Chat_AllDead");
	}
	else
	{
		copy(szFormat, charsmax(szFormat), "#Cstrike_Chat_All");
	}

	format(szText, charsmax(szText), "^x04%s", szText);

	//server_print("szText = %s", szText);

	new Players[MAX_PLAYERS];
	new iPlayerCount, i;
	new pPlayer;

	get_players(Players, iPlayerCount, "ch");

	for (i = 0; i < iPlayerCount; i++)
	{
		pPlayer = Players[i];

		if (!bIsAlive && is_user_alive(pPlayer) || bIsAlive && !is_user_alive(pPlayer))
			continue;

		message_begin(MSG_ONE, g_msgSayText, .player = pPlayer)
		{
			write_byte(this);
			write_string(szFormat);
			write_string("");
			write_string(szText);
		}
		message_end();
	}

	return PLUGIN_HANDLED;
}
__________________








CrazY. is offline
thEsp
BANNED
Join Date: Aug 2017
Old 03-25-2019 , 14:48   Re: SayText colored message
Reply With Quote #2

PHP Code:
 message_begin(MsgTypeget_user_msgid("SayText"), _index)
write_byte(index// player
write_string(msg// Message
message_end() 
It will not work obviously with #Cstrike...
thEsp is offline
E1_531G
Senior Member
Join Date: Dec 2017
Old 03-25-2019 , 14:52   Re: SayText colored message
Reply With Quote #3

AFAIK, the channels feature doesn't work for a long time.
At least, many if not all "color chat" plugins or includes don't use it in recent years.
__________________
My English is A0
E1_531G is offline
CrazY.
Veteran Member
Join Date: May 2015
Location: SP, Brazil
Old 03-25-2019 , 15:11   Re: SayText colored message
Reply With Quote #4

Quote:
Originally Posted by thEsp View Post
PHP Code:
 message_begin(MsgTypeget_user_msgid("SayText"), _index)
write_byte(index// player
write_string(msg// Message
message_end() 
It will not work obviously with #Cstrike...
Not only will work as it is already working. If that were right players wouldn't be able to write anything with say/say_team.
https://github.com/s1lentq/ReGameDLL...lient.cpp#L822

Quote:
Originally Posted by E1_531G View Post
AFAIK, the channels feature doesn't work for a long time.
At least, many if not all "color chat" plugins or includes don't use it in recent years.
Yes I just did it like others and that fixed the issue.
__________________








CrazY. 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 07:12.


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