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

Solved Message to appear only after first round not after warmup


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Razvann.
Senior Member
Join Date: Jul 2012
Old 01-24-2021 , 15:21   Message to appear only after first round not after warmup
Reply With Quote #1

Hello! How can I edit this plugin to show both messages from him to appear only after first round played not after warmup?

Code:
#include <sourcemod>
#include <cstrike>
#include <zephstocks>

#pragma semicolon 1

#define PLUGIN_VERSION "1.0.1"

public Plugin:myinfo = 
{
	name = "alliedmods",
	author = "alliedmods",
	description = "alliedmods",
	version = PLUGIN_VERSION,
	url = "http://www.alliedmods.net"
};

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)
{
	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;
}
Thanks!

Last edited by Razvann.; 01-30-2021 at 20:55.
Razvann. is offline
Send a message via Yahoo to Razvann.
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 01-24-2021 , 15:29   Re: Message to appear only after first round not after warmup
Reply With Quote #2

PHP Code:


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

    
CreateTimer(3.0LeaderAnnounceTimer);

__________________
Ilusion9 is offline
Razvann.
Senior Member
Join Date: Jul 2012
Old 01-24-2021 , 15:34   Re: Message to appear only after first round not after warmup
Reply With Quote #3

Thanks!
Razvann. is offline
Send a message via Yahoo to Razvann.
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.
Ilusion9
Veteran Member
Join Date: Jun 2018
Location: Romania
Old 01-28-2021 , 17:02   Re: Message to appear only after first round not after warmup
Reply With Quote #5

PHP Code:

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

    
CreateTimer(3.0LeaderAnnounceTimer);

__________________
Ilusion9 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:37.


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