View Single Post
Razvann.
Senior Member
Join Date: Jul 2012
Old 01-28-2021 , 16:28   Re: Message to appear only after first round not after warmup
Reply With Quote #4

I tested and still is showed after warmup
Ps; I use weapon_restrict for Warmup and your plugin for skip 1v1 warmup

Imi apare mesajul fix in prima runda, in loc de a 2-a runda, am modificat corect sau?

Code:
public OnPluginStart()
{
	IdentifyGame();

	// Supress warnings about unused variables.....
	if(g_bL4D || g_bL4D2 || g_bND) {}

	CreateConVar("sm_showleader_csgo_version", PLUGIN_VERSION, "Plugin version", FCVAR_CHEAT|FCVAR_DONTRECORD|FCVAR_NOTIFY|0|FCVAR_SPONLY);
	HookEvent("round_start", OnRoundStart);
}

public OnRoundStart(Handle:event, const String:name[], bool:dontBroadcast)
{
    if (GameRules_GetProp("m_bWarmupPeriod")) return;

    CreateTimer(3.0, LeaderAnnounceTimer);
}

public Action:LeaderAnnounceTimer(Handle:timer, any:data)
{
	new String:m_szMessage[256];

	new Leader = FindLeader();
	if(Leader == 0)
		return Plugin_Handled;
	new Frags = GetClientFrags(Leader);
	new Deaths = GetClientDeaths(Leader);

	if(g_bCSGO)
	{
		new Assists = CS_GetClientAssists(Leader);
		new Score = CS_GetClientContributionScore(Leader);
		Format(STRING(m_szMessage), "• {teamcolor}%N [Scor: %d] {default}este cel mai mare {green}alcoolist {default}cu {lightred}%d/%d/%i", Leader, Score, Frags, Assists, Deaths);
	}
	else
	{
		Format(STRING(m_szMessage), "• {teamcolor}%N [Scor: %d] {default}este cel mai mare {green}alcoolist {default}cu {lightred}%d/%i", Leader, Frags, Frags, Deaths);
	}

	ReplaceColors(STRING(m_szMessage), Leader);
	PrintToChatAll(m_szMessage);
	
	return Plugin_Handled;
}

FindLeader()
{
	new Leader = 0;
	new Score = -1;
	for(new i = 1; i <= MaxClients; i++)
	{
		if(IsClientInGame(i) && ((g_bCSGO && CS_GetClientContributionScore(i) > Score) || (!g_bCSGO && GetClientFrags(i) > Score)))
		{
			if(g_bCSGO)
				Score = CS_GetClientContributionScore(i);
			else
				Score = GetClientFrags(i);
			Leader = i;
		}
	}
	return Leader;
}

Last edited by Razvann.; 01-28-2021 at 16:29.
Razvann. is offline
Send a message via Yahoo to Razvann.