Raised This Month: $32 Target: $400
 8% 

Solved [CSGO] Add color to 2 messages


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Razvann.
Senior Member
Join Date: Jul 2012
Old 02-05-2021 , 18:07   [CSGO] Add color to 2 messages
Reply With Quote #1

Hello, can u add please for me color red for "Dropped bomb" and green for "Pickeup bomb"?
I tried with colors.inc and still doesnt work..

Code:
#include <cstrike>

public OnPluginStart()
{
	HookEvent("bomb_dropped", bomb);
	HookEvent("bomb_pickup", bomb);
}

public bomb(Handle:event, const String:name[], bool:dontBroadcast)
{
	new client;
	client = GetClientOfUserId(GetEventInt(event, "userid"));

	if(client) // Clientindex not 0 = Console
	{
		new numClients, clients[MaxClients];

		for(new i = 1; i <= MaxClients; i++)
		{
			if(IsClientInGame(i) && !IsFakeClient(i) && GetClientTeam(i) == CS_TEAM_T && IsPlayerAlive(i)) // Chat message alive Terrorists, no bots
			{
				clients[numClients] = i; // Collect player indexs
				numClients++;
			}
		}

		if(numClients < 1) // No players
		{
			return;
		}

		new Handle:hBf;
		hBf = StartMessage("TextMsg", clients, numClients);

		if (hBf != INVALID_HANDLE)
		{
			new String:buffer[128];

			if(GetUserMessageType() == UM_Protobuf)
			{
				StrEqual(name, "bomb_pickup", false) ? Format(buffer, sizeof(buffer), "#Cstrike_TitlesTXT_Game_bomb_pickup"):Format(buffer, sizeof(buffer), "#Cstrike_TitlesTXT_Game_bomb_drop"); // Game own translations
				PbSetInt(hBf, "msg_dst", 3);
				PbAddString(hBf, "params", buffer);
				Format(buffer, MAX_NAME_LENGTH, "%N", client);
				PbAddString(hBf, "params", buffer);
				PbAddString(hBf, "params", "");
				PbAddString(hBf, "params", "");
				PbAddString(hBf, "params", "");
			}
			else
			{
				StrEqual(name, "bomb_pickup", false) ? Format(buffer, sizeof(buffer), "#Game_bomb_pickup"):Format(buffer, sizeof(buffer), "#Game_bomb_drop"); // Game own translations
				BfWriteString(hBf, buffer);
				Format(buffer, MAX_NAME_LENGTH, "%N", client); // Bomp carrier name
				BfWriteString(hBf, buffer);
			}
			EndMessage();
		}
	}
}
Thank you!

Last edited by Razvann.; 02-07-2021 at 08:20.
Razvann. is offline
Send a message via Yahoo to Razvann.
NanoC
Veteran Member
Join Date: Jan 2016
Location: Argentina
Old 02-05-2021 , 18:44   Re: [CSGO] Add color to 2 messages
Reply With Quote #2

#include <multicolors>

CPrintToChatAll("Text");
__________________
NanoC is offline
Send a message via Skype™ to NanoC
Razvann.
Senior Member
Join Date: Jul 2012
Old 02-05-2021 , 18:59   Re: [CSGO] Add color to 2 messages
Reply With Quote #3

I dont know how to add, can u help me? Only those 2 things; Red for Dropped, and Green for Pickup
Razvann. is offline
Send a message via Yahoo to Razvann.
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-05-2021 , 19:25   Re: [CSGO] Add color to 2 messages
Reply With Quote #4

Not sure you can do it straight to #translated phrase.
Because #translation happen inside player game, server just send #phrase to trigger it. (I'm not 100% sure)

You maybe need use default english phrase, or create language files in SourceMod.
__________________
Do not Private Message @me

Last edited by Bacardi; 02-05-2021 at 19:26.
Bacardi is offline
Razvann.
Senior Member
Join Date: Jul 2012
Old 02-06-2021 , 18:09   Re: [CSGO] Add color to 2 messages
Reply With Quote #5

I found few years ago a version of this plugin with color, but I search months for that version and no succese.. and it was without translate file, maybe now is not possible anymore?
Razvann. is offline
Send a message via Yahoo to Razvann.
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 02-07-2021 , 04:55   Re: [CSGO] Add color to 2 messages
Reply With Quote #6

Here. And from original plugin topic. Not always need create new threat, you could have ask.
__________________
Do not Private Message @me

Last edited by Bacardi; 02-07-2021 at 04:55.
Bacardi 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:43.


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