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

How to Avoid this in Statsx?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xExperienced
Member
Join Date: Jun 2017
Location: USA
Old 07-13-2017 , 10:48   How to Avoid this in Statsx?
Reply With Quote #1

As you know statsx shows "Best Score" in HUD only..

I wanted "Best Score (of round)" function of Statsx to be printed in chat also..

I added some code but it is printing same line 3-4 times even after new round starts..


The Code which I added is in bold :

Code:
// Get and format best score.
add_best_score(id, sBuffer[MAX_BUFFER_LENGTH + 1])
{
	new iPlayer, iMaxKillsId, iMaxKills, iMaxHeadShots

	iMaxKillsId = 0
	iMaxKills = 0
	iMaxHeadShots = 0

	// Find player
	for (iPlayer = 1; iPlayer <= MaxClients; iPlayer++)
	{
		if (g_izUserRndStats[iPlayer][STATS_KILLS] >= iMaxKills && (g_izUserRndStats[iPlayer][STATS_KILLS] > iMaxKills || g_izUserRndStats[iPlayer][STATS_HS] > iMaxHeadShots))
		{
			iMaxKillsId = iPlayer
			iMaxKills = g_izUserRndStats[iPlayer][STATS_KILLS]
			iMaxHeadShots = g_izUserRndStats[iPlayer][STATS_HS]
		}
	}

	// Format statistics.
	if (iMaxKillsId)
	{
		iPlayer = iMaxKillsId

		new Float:fGameEff = effec(g_izUserGameStats[iPlayer])
		new Float:fRndAcc = accuracy(g_izUserRndStats[iPlayer])

		{
		formatex(t_sText, charsmax(t_sText), "%L: %s^n%d %L / %d hs -- %0.2f%% %L / %0.2f%% %L^n", id, "BEST_SCORE", g_izUserRndName[iPlayer],
				iMaxKills, id, "KILL_S", iMaxHeadShots, fGameEff, id, "EFF", fRndAcc, id, "ACC")
		add(sBuffer, charsmax(sBuffer), t_sText)
		}
		
		{
		colorchat(0, "^x04Round's Best Score : ^x03%s ^x01- ^x04%d ^x03%L ^x01| ^x04%d ^x03Headshot(s) ^x01| ^x04 %0.2f%% ^x03%L ^x01| ^x04 %0.2f%% ^x03%L", g_izUserRndName[iPlayer],
				iMaxKills, id, "KILL_S", iMaxHeadShots, fGameEff, id, "EFF", fRndAcc, id, "ACC")
		}		
	}

	return iMaxKillsId
}


See this I wanna Avoid it.. It shud print once only...

xExperienced 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 02:20.


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