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

Using two team colors in one message is not allowed


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Razvann.
Senior Member
Join Date: Jul 2012
Old 01-28-2021 , 16:30   Using two team colors in one message is not allowed
Reply With Quote #1

Where I use in this translate file same 2 team colors..?

Code:
	{
		"#format"		"{1:s},{2:s}"
		"ro"			"Ai ales firul {{1}}{2}{default}."
	}

	"sm_qd_panel_defuse"
	{
		"#format"		"{1:N},{2:s},{3:s}"
		"ro"			"{default}{1} a taiat corect firul {{2}}{3}{default} pentru dezamorsare instantă (1:4 șanse)."
	}

	"sm_qd_panel_defuse_incorrected"
	{
		"#format"		"{1:N},{2:s},{3:s},{4:s},{5:s}"
		"ro"			"{default}{1} a detonat bomba pentru că a ales firul greșit {{2}}{3}{default} (3:4 șanse).\n {default}Firul corect era {{4}}{5}."
	}

	"sm_qd_panel_defuse_nokit"
	{
		"#format"		"{1:N},{2:s},{3:s}"
		"ro"			"{default}{1} a tăiat corect firul {{2}}{3}{default} pentru dezamorsare instantă (1:8 șanse)."
	}

	"sm_qd_panel_defuse_nokit_incorrected"
	{
		"#format"		"{1:N},{2:s},{3:s},{4:s},{5:s}"
		"ro"			"{default}{1} a detonat bomba pentru că a ales firul greșit {{2}}{3}{default} (7:8 șanse).\n {default}Firul corect era {{4}}{5}."
	}

	"sm_qd_panel_defuse_nokit_correct"
	{
		"#format"		"{1:N},{2:s},{3:s}"
		"ro"			"{default}{1} a ales corect firul {{2}}{3}{default}, dar bomba tot a explodat (50-50% șanse dacă nu ai kit)"
	}
Razvann. is offline
Send a message via Yahoo to Razvann.
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 01-29-2021 , 19:18   Re: Using two team colors in one message is not allowed
Reply With Quote #2

AFAIK you can't, at least in L4D2, you can only output a single team based color (e.g. red/blue/white).
I don't know in CSGO, etc.

From my knowledge, we use a SayText2 function that simulates someone chatting, that's why we are able to change the colour to red/blue, but not using both.
__________________

Last edited by Marttt; 01-30-2021 at 18:17.
Marttt is offline
Razvann.
Senior Member
Join Date: Jul 2012
Old 01-30-2021 , 15:48   Re: Using two team colors in one message is not allowed
Reply With Quote #3

But in what sentence from my messages is 2 team colors? Cuz I didn't find
Razvann. is offline
Send a message via Yahoo to Razvann.
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-30-2021 , 18:13   Re: Using two team colors in one message is not allowed
Reply With Quote #4

It's in plugin code
__________________
Do not Private Message @me
Bacardi is offline
Marttt
Veteran Member
Join Date: Jan 2019
Location: Brazil
Old 01-30-2021 , 18:19   Re: Using two team colors in one message is not allowed
Reply With Quote #5

Unfortunately, I couldn't understand any of your posts Razvann, don't know if you are using google translate.

Btw, I didn't get if you want to add to color to the phrases (.txt) file or if is outputting 1 team color, and you want to have 2 (e.g. red/blue).

If this plugin is using some kind of ChatProcessor probably in the code you will have something like "CPrintToChat" instead "PrintToChat"

Then you can try to "{red}" to your phrases file and check if it outputs in red.
__________________
Marttt is offline
TomL.
Veteran Member
Join Date: Oct 2017
Location: Germany
Old 01-30-2021 , 19:26   Re: Using two team colors in one message is not allowed
Reply With Quote #6

He provided more details in this plugin thread.

Last edited by TomL.; 01-30-2021 at 19:26.
TomL. is offline
Razvann.
Senior Member
Join Date: Jul 2012
Old 01-30-2021 , 20:48   Re: Using two team colors in one message is not allowed
Reply With Quote #7

My bad (english).

So I use this plugin: https://github.com/Nerus87/QuickDefu...emod/scripting

When somebody use Red color or planting with Red color, in chat Red color is showed like an yellow (terro color)

And I think error with Two team colors in one message appear from same thing, or maybe another

Full phase:
Code:
"Phrases"
{
	// In game chat
	"sm_qd_panel_plant"
	{
		"#format"		"{1:s},{2:s}"
		"ro"			"Ai ales firul {{1}}{2}{default}."
	}

	"sm_qd_panel_defuse"
	{
		"#format"		"{1:N},{2:s},{3:s}"
		"ro"			"{default}{1} a taiat corect firul {{2}}{3}{default} pentru dezamorsare instantă (1:4 șanse)."
	}

	"sm_qd_panel_defuse_incorrected"
	{
		"#format"		"{1:N},{2:s},{3:s},{4:s},{5:s}"
		"ro"			"{default}{1} a detonat bomba pentru că a ales firul greșit {{2}}{3}{default} (3:4 șanse).\n {default}Firul corect era {{4}}{5}."
	}

	"sm_qd_panel_defuse_nokit"
	{
		"#format"		"{1:N},{2:s},{3:s}"
		"ro"			"{default}{1} a tăiat corect firul {{2}}{3}{default} pentru dezamorsare instantă (1:8 șanse)."
	}

	"sm_qd_panel_defuse_nokit_incorrected"
	{
		"#format"		"{1:N},{2:s},{3:s},{4:s},{5:s}"
		"ro"			"{default}{1} a detonat bomba pentru că a ales firul greșit {{2}}{3}{default} (7:8 șanse).\n {default}Firul corect era {{4}}{5}."
	}

	"sm_qd_panel_defuse_nokit_correct"
	{
		"#format"		"{1:N},{2:s},{3:s}"
		"ro"			"{default}{1} a ales corect firul {{2}}{3}{default}, dar bomba tot a explodat (50-50% șanse dacă nu ai kit)"
	}

	"sm_qd_plant_panel_title"
	{
		"ro"	"Alege un fir:"
	}

	"sm_qd_plant_panel_info"
	{
		"ro"	"CT pot să ghicească firul corect pentru dezamorsare rapidă."
	}

	"sm_qd_plant_panel_ignore"
	{
		"ro"	"Ieși, sau ignoră culoarea ptr. un fir aleatoriu."
	}

	"sm_qd_defuse_panel_title"
	{
		"ro"	"Alege un fir:"
	}

	"sm_qd_defuse_panel_ignore"
	{
		"ro"	"Ignoră pentru dezamorsare normală"
	}

	"sm_qd_defuse_panel_info"
	{
		"ro"	"Alege corect și dezamorsează instant C4"
	}

	"sm_qd_defuse_panel_info2"
	{
		"ro"	"Alege greșit și C4 va exploda instant"
	}

	"sm_qd_defuse_panel_nokit_info"
	{
		"ro"	"Fără un kit de dezamorsare sunt 50% mai multe șanse să explodeze,"
	}

	"sm_qd_defuse_panel_nokit_info2"
	{
		"ro"	"chiar dacă alegi firul corect."
	}

	"sm_qd_panel_exit"
	{
		"ro"	"Iesi"
	}

	"sm_qd_wire_blue"
	{
		"ro"	"Albastru"
	}

	"sm_qd_wire_yellow"
	{
		"ro"	"Galben"
	}

	"sm_qd_wire_red"
	{
		"ro"	"Rosu"
	}

	"sm_qd_wire_green"
	{
		"ro"	"Verde"
	}
}
Plugin:
Code:
#include <quickdefuse>

#pragma newdecls required

#define PLUGIN_NAME				"Quick Defuse"
#define PLUGIN_VERSION			"v2.0"
#define PLUGIN_DESCRIPTION		"Let's CT's choose a selectedWire for quick defusion."

int selectedWire = 0;

char wirecolours[4][16] = {"blue", "yellow", "red", "green"};

ConVar sm_quickdefuse = null;
ConVar sm_quickdefuse_debug = null;
ConVar sm_quickdefuse_terrorist_select = null;
ConVar sm_quickdefuse_select_notification = null;
ConVar sm_quickdefuse_panel_draw_time = null;

Handle forward_on_player_defuse = INVALID_HANDLE;

public Plugin myinfo = {
	name = PLUGIN_NAME,
	author = "pRED*, refactored by Nerus ",
	description = PLUGIN_DESCRIPTION,
	version = PLUGIN_VERSION,
	url = "https://forums.alliedmods.net/"
};

public void SetConVars()
{
	/// Plugin ConVar's
	sm_quickdefuse = CreateConVar("sm_quickdefuse", "1", "Enable or disable plugin: '0' - disabled, '1' - enabled.");

	sm_quickdefuse_debug = CreateConVar("sm_quickdefuse_debug", "0", "Debug plugin: '0' - disabled, '1' - enabled.");

	sm_quickdefuse_terrorist_select = CreateConVar("sm_quickdefuse_terrorist_select", "1", "Enable or disable the ability to select wire by the terrorist: '0' - plugin random select, '1' - player select.");

	sm_quickdefuse_select_notification = CreateConVar("sm_quickdefuse_select_notification", "1", "Enable or disable player notification of wire selection : '0' - disabled, '1' - enabled.");

	sm_quickdefuse_panel_draw_time = CreateConVar("sm_quickdefuse_panel_draw_time", "5", "Draw panel to player in N seconds.");

	AutoExecConfig(true, "quickdefuse");
}

public void SetHooks()
{
	HookEvent("bomb_begindefuse", OnBombDefuse, EventHookMode_Post);
	HookEvent("bomb_beginplant", OnBombPlant, EventHookMode_Post);
	HookEvent("bomb_planted", OnBombPlanted, EventHookMode_PostNoCopy);
	
	HookEvent("bomb_abortdefuse", OnBombActionInterupted, EventHookMode_Post);
	HookEvent("bomb_abortplant", OnBombActionInterupted, EventHookMode_Post);
}

public void SetTranslation()
{
	LoadTranslations("quickdefuse.phrases");
}

public void RegisterForwards()
{
	forward_on_player_defuse = CreateGlobalForward("OnPlayerDefuseC4", ET_Ignore, Param_Cell);
}

public void OnPluginStart()
{
	SetTranslation();

	SetConVars();

	SetHooks();

	RegisterForwards();
}

public void OnBombPlant(Event event, const char[] name, bool dontBroadcast)
{
	if(!sm_quickdefuse.BoolValue)
		return;

	selectedWire = 0;

	int client = GetClientFromEvent(event);

	if(!IsValidPlayer(client, !ONLY_HUMMANS))
		return;

	if(sm_quickdefuse_terrorist_select.BoolValue && !IsBot(client))
	{
		CreatePlantPanel(client);
	}
	else
	{
		selectedWire = GetRandomInt(1, 4);

		if(sm_quickdefuse_select_notification.BoolValue && !IsBot(client))
		{
			NotifyPlayerSelection(client, selectedWire);
		}
	}
}

public void OnBombPlanted(Event event, const char[] name, bool dontBroadcast)
{
	if(!sm_quickdefuse.BoolValue)
		return;

	if (selectedWire == 0)
	{
		selectedWire = GetRandomInt(1, 4);	
	}
}

public void OnBombDefuse(Event event, const char[] name, bool dontBroadcast)
{
	if(!sm_quickdefuse.BoolValue)
		return;

	CreateDefusePanel(GetClientFromEvent(event), GetEventBool(event, "haskit"));
}

public int PanelPlant(Menu menu, MenuAction action, int param1, int param2)
{
	if(!IsValidPlayer(param1, ONLY_HUMMANS) || action != MenuAction_Select || !IsInSelectableRange(param2))
		return 0;

	selectedWire = param2;

	if(sm_quickdefuse_select_notification.BoolValue && !IsBot(param1))
	{
		NotifyPlayerSelection(param1, param2);
	}

	return 0;
}

public int PanelDefuseKit(Menu menu, MenuAction action, int param1, int param2)
{
	if(!IsValidPlayer(param1, ONLY_HUMMANS) || action != MenuAction_Select || !IsInSelectableRange(param2))
		return 0;
	
	int bombent = FindEntityByClassname(-1, "planted_c4");
	
	if(!IsValidEntity(bombent))
		return 0;

	if (param2 == selectedWire)
	{
		ForwardPlayerDefuseC4(param1);
		
		SetEntPropFloat(bombent, Prop_Send, "m_flDefuseCountDown", 1.0);

		char color[16];
		TranslateColor(wirecolours[param2-1], color);

		CPrintToChatAll("%t", "sm_qd_panel_defuse", param1, wirecolours[param2-1], color);
	}
	else
	{
		SetEntPropFloat(bombent, Prop_Send, "m_flC4Blow", 1.0);

		char color[16];
		TranslateColor(wirecolours[param2-1], color);

		char color2[16];
		TranslateColor(wirecolours[selectedWire-1], color2);
		
		CPrintToChatAll("%t", "sm_qd_panel_defuse_incorrected", param1, wirecolours[param2-1], color, wirecolours[selectedWire-1], color2);
	}

	return 0;
}

public int PanelDefuseNoKit(Menu menu, MenuAction action, int param1, int param2)
{
	if (!IsValidPlayer(param1, ONLY_HUMMANS) || action != MenuAction_Select || !IsInSelectableRange(param2))
		return 0;

	int bombent = FindEntityByClassname(-1, "planted_c4");
	
	if(!IsValidEntity(bombent))
		return 0;

	if (param2 == selectedWire && GetRandomInt(0,1))
	{
		ForwardPlayerDefuseC4(param1);

		SetEntPropFloat(bombent, Prop_Send, "m_flDefuseCountDown", 1.0);

		char color[16];
		TranslateColor(wirecolours[param2-1], color);
		CPrintToChatAll("%t", "sm_qd_panel_defuse_nokit", param1, wirecolours[param2-1], color);
	}
	else
	{
		SetEntPropFloat(bombent, Prop_Send, "m_flC4Blow", 1.0);

		if (param2 != selectedWire)
		{
			char color[16];
			TranslateColor(wirecolours[param2-1], color);

			char color2[16];
			TranslateColor(wirecolours[selectedWire-1], color2);

			CPrintToChatAll("%t", "sm_qd_panel_defuse_nokit_incorrected", param1, wirecolours[param2-1], color, wirecolours[selectedWire-1], color2);
		}
		else
		{
			char color[16];
			TranslateColor(wirecolours[param2-1], color);
			CPrintToChatAll("%t", "sm_qd_panel_defuse_nokit_correct", param1, wirecolours[param2-1], color);
		}
	}

	return 0;
}

public void OnBombActionInterupted(Event event, const char[] name, bool dontBroadcast)
{
	int client = GetClientFromEvent(event);

	if(!IsValidPlayer(client, ONLY_HUMMANS))
		return;

	CancelClientMenu(client);
}

public void CreatePlantPanel(int client)
{
	if(!IsValidPlayer(client, ONLY_HUMMANS))
		return;

	Panel panel = CreatePanel();

	char title[32];
	Format(title, sizeof(title), "%t", "sm_qd_plant_panel_title");
	panel.SetTitle(title);
	
	panel.DrawText(" ");
	
	char text[256];
	Format(text, sizeof(text), "%t", "sm_qd_plant_panel_info");
	panel.DrawText(text);

	Format(text, sizeof(text), "%t", "sm_qd_plant_panel_ignore");
	panel.DrawText(text);

	panel.DrawText(" ");

	char color[16];
	Format(color, sizeof(color), "%t", "sm_qd_wire_blue");
	panel.DrawItem(color);

	Format(color, sizeof(color), "%t", "sm_qd_wire_yellow");
	panel.DrawItem(color);

	Format(color, sizeof(color), "%t", "sm_qd_wire_red");
	panel.DrawItem(color);

	Format(color, sizeof(color), "%t", "sm_qd_wire_green");
	panel.DrawItem(color);

	panel.DrawText(" ");

	char exit_panel[16];
	Format(exit_panel, sizeof(exit_panel), "%t", "sm_qd_panel_exit");
	panel.DrawItem(exit_panel);

	SendPanelToClient(panel, client, PanelPlant, sm_quickdefuse_panel_draw_time.IntValue);

	CloseHandle(panel);
}

public void CreateDefusePanel(int client, bool haskit)
{
	if(!IsValidPlayer(client, ONLY_HUMMANS))
		return;

	Panel panel = CreatePanel();

	char title[32];
	Format(title, sizeof(title), "%t", "sm_qd_defuse_panel_title");
	panel.SetTitle(title);

	char text[256];
	Format(text, sizeof(text), "%t", "sm_qd_defuse_panel_ignore");
	panel.DrawText(text);

	panel.DrawText(" ");

	Format(text, sizeof(text), "%t", "sm_qd_defuse_panel_info");
	panel.DrawText(text);

	Format(text, sizeof(text), "%t", "sm_qd_defuse_panel_info2");
	panel.DrawText(text);

	if (!haskit)
	{
		Format(text, sizeof(text), "%t", "sm_qd_defuse_panel_nokit_info");
		panel.DrawText(text);
		
		Format(text, sizeof(text), "%t", "sm_qd_defuse_panel_nokit_info2");
		panel.DrawText(text);
	}

	panel.DrawText(" ");

	char color[16];
	Format(color, sizeof(color), "%t", "sm_qd_wire_blue");
	panel.DrawItem(color);

	Format(color, sizeof(color), "%t", "sm_qd_wire_yellow");
	panel.DrawItem(color);

	Format(color, sizeof(color), "%t", "sm_qd_wire_red");
	panel.DrawItem(color);

	Format(color, sizeof(color), "%t", "sm_qd_wire_green");
	panel.DrawItem(color);
	
	panel.DrawText(" ");
	
	char exit_panel[16];
	Format(exit_panel, sizeof(exit_panel), "%t", "sm_qd_panel_exit");
	panel.DrawItem(exit_panel);

	if (haskit)
		SendPanelToClient(panel, client, PanelDefuseKit, sm_quickdefuse_panel_draw_time.IntValue);
	else
		SendPanelToClient(panel, client, PanelDefuseNoKit, sm_quickdefuse_panel_draw_time.IntValue);

	CloseHandle(panel);
}

public bool IsInSelectableRange(int param)
{
	return (param > 0 && param < 5);
}

public void ForwardPlayerDefuseC4(int client)
{
	if(!IsValidPlayer(client, ONLY_HUMMANS) || !IsValidHandler(forward_on_player_defuse))
		return;

	if(sm_quickdefuse_debug.BoolValue)
		PrintToServer("[Quick Defuse] Debug | Player '%N' use wire for quick defuse!", client);

	Call_StartForward(forward_on_player_defuse);

	Call_PushCell(client);

	Call_Finish();
}

public void NotifyPlayerSelection(int client, int wire)
{
	char color[16];
	TranslateColor(wirecolours[wire-1], color);

	CPrintToChat(client, "%t", "sm_qd_panel_plant", wirecolours[wire-1], color);
}

public void TranslateColor(const char[] color, char translation[16])
{
	if(StrEqual(color, "blue", false))
	{
		Format(translation, sizeof(translation), "%t", "sm_qd_wire_blue");

		return;
	}

	if(StrEqual(color, "yellow", false))
	{
		Format(translation, sizeof(translation), "%t", "sm_qd_wire_yellow");

		return;
	}

	if(StrEqual(color, "red", false))
	{
		Format(translation, sizeof(translation), "%t", "sm_qd_wire_red");

		return;
	}

	if(StrEqual(color, "green", false))
	{
		Format(translation, sizeof(translation), "%t", "sm_qd_wire_green");

		return;
	}
}

Last edited by Razvann.; 01-30-2021 at 20:52.
Razvann. is offline
Send a message via Yahoo to Razvann.
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-30-2021 , 21:16   Re: Using two team colors in one message is not allowed
Reply With Quote #8

Is that "ro" translation file your only, base file, in translation folder?

Because, if you have default "en" translation file as base file, in translation folder,
that file only hold "#format" parameters.

Then another files, ex "ro", goes ...ro/ folder and
it can not include anymore "#format" parameters.

https://wiki.alliedmods.net/Translations_(SourceMod_Scripting)

There is bad example in github, "pl" translation.
__________________
Do not Private Message @me

Last edited by Bacardi; 01-30-2021 at 21:18.
Bacardi is offline
Razvann.
Senior Member
Join Date: Jul 2012
Old 01-30-2021 , 21:23   Re: Using two team colors in one message is not allowed
Reply With Quote #9

Yes, I know how to use "ro" instead of "en", all my plugins are in "RO" translated without no problem.. (+ /ro folder)


L 01/31/2021 - 01:27:58: [SM] [1] Line 410, C:\Users\Babusca\Desktop\scripting\include\mu lticolors/colors.inc::C_Format
L 01/31/2021 - 01:27:58: [SM] [2] Line 85, C:\Users\Babusca\Desktop\scripting\include\mu lticolors/colors.inc::C_PrintToChat
L 01/31/2021 - 01:27:58: [SM] [3] Line 104, C:\Users\Babusca\Desktop\scripting\include\mu lticolors.inc::CPrintToChatAll
L 01/31/2021 - 01:27:58: [SM] [4] Line 182, quickdefuse.sp:anelDefuseKit
L 01/31/2021 - 011:20: [SM] Exception reported: Using two team colors in one message is not allowed


"[4] Line 182, quickdefuse.sp:anelDefuseKit" maybe this is the problem? I didn't found any issue in my translated parte of PanelDefuseKit, or am I blind?

Last edited by Razvann.; 01-30-2021 at 21:33.
Razvann. is offline
Send a message via Yahoo to Razvann.
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 01-30-2021 , 22:32   Re: Using two team colors in one message is not allowed
Reply With Quote #10

Maybe you need change wire colors, red and blue to else.
After all, ct have blue team color and t red team color.

Which game cause this problem?
You should mention it in first post to make our life easier.
__________________
Do not Private Message @me
Bacardi 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 04:13.


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