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

SayText colored message


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
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
 



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 08:07.


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