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

Extra Code for Colorchat in Statsx


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
xExperienced
Member
Join Date: Jun 2017
Location: USA
Old 07-11-2017 , 10:49   Extra Code for Colorchat in Statsx
Reply With Quote #1

Can someone please provide me a code to show best score of the round in chat ? (Statsx.amxx)


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)
	}

	return iMaxKillsId
}
xExperienced is offline
sayf118
Member
Join Date: Jul 2017
Old 07-11-2017 , 11:58   Re: Extra Code for Colorchat in Statsx
Reply With Quote #2

add in first line #include <colorchat>
try this but i tihnk it won't work because you should post .txt file of this plugin
Quote:
// 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])

ColorChat(0,GREY, "The best score is: %s^n%d %L / %d hs -- %0.2f%% %L / %0.2f%% %L^n ", g_izUserRndName[iPlayer],
iMaxKills, id, "KILL_S", iMaxHeadShots, fGameEff, id, "EFF", fRndAcc, id, "ACC")
add(sBuffer, charsmax(sBuffer), t_sText)
}

return iMaxKillsId
}

Last edited by sayf118; 07-11-2017 at 11:59.
sayf118 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-11-2017 , 13:09   Re: Extra Code for Colorchat in Statsx
Reply With Quote #3

There's no chat messages in the code you provided.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
xExperienced
Member
Join Date: Jun 2017
Location: USA
Old 07-11-2017 , 14:34   Re: Extra Code for Colorchat in Statsx
Reply With Quote #4

@sayf118 Thanks for the reply..

I tried somthing like this :

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)
		}
		
		{
		client_print_color(0, print_team_default, "^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
}

Changes which I made are in Bold..
It worked..
but It is showing same "Round's Best Score: xxx" line 3-4 times...
How to fix ? Even I tried putting brackets but still getting printed many times even getting printed after new round starts..

Last edited by xExperienced; 07-11-2017 at 14:35.
xExperienced is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-11-2017 , 16:02   Re: Extra Code for Colorchat in Statsx
Reply With Quote #5

Quote:
Originally Posted by OciXCrom View Post
There's no chat messages in the code you provided.
__________________
OciXCrom is offline
Send a message via Skype™ to OciXCrom
xExperienced
Member
Join Date: Jun 2017
Location: USA
Old 07-11-2017 , 23:52   Re: Extra Code for Colorchat in Statsx
Reply With Quote #6

There's no chat message code for "Best Score" in orignal statsx plugin..


Please see my last reply... I have added some code but it is printing same line 2-3 times...
Need help in fixing that.

Last edited by xExperienced; 07-11-2017 at 23:52.
xExperienced is offline
sayf118
Member
Join Date: Jul 2017
Old 07-12-2017 , 02:23   Re: Extra Code for Colorchat in Statsx
Reply With Quote #7

try this:
Quote:
// 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)
}

{
client_print_color(0, print_team_default, "^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
}
you should make space between color code and tags ex:
^x04 %0.2f%%

Last edited by sayf118; 07-12-2017 at 02:25.
sayf118 is offline
Old 07-12-2017, 02:26
sayf118
This message has been deleted by sayf118.
sayf118
Member
Join Date: Jul 2017
Old 07-12-2017 , 02:28   Re: Extra Code for Colorchat in Statsx
Reply With Quote #8

yes ther is colorchat(0,GREY,.....)
sayf118 is offline
OciXCrom
Veteran Member
Join Date: Oct 2013
Location: Macedonia
Old 07-12-2017 , 07:56   Re: Extra Code for Colorchat in Statsx
Reply With Quote #9

For the last time - you didn't provide the code that contains the chat message. Chat message is sent through the function client_print(index, print_chat, ...), not formatex. Changing formatex to colorchat will send another message, because the other one is still there.
__________________

Last edited by OciXCrom; 07-12-2017 at 07:57.
OciXCrom is offline
Send a message via Skype™ to OciXCrom
xExperienced
Member
Join Date: Jun 2017
Location: USA
Old 07-12-2017 , 08:24   Re: Extra Code for Colorchat in Statsx
Reply With Quote #10

Quote:
Originally Posted by OciXCrom View Post
For the last time - you didn't provide the code that contains the chat message. Chat message is sent through the function client_print(index, print_chat, ...), not formatex. Changing formatex to colorchat will send another message, because the other one is still there.
Read post carefully.
I said :
"Can someone please provide me a code to show best score of the round in chat ? (Statsx.amxx)"

then how can I provide you the chat message code ?

I think u thought I have normal message but want it to be converted in color one?
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 07:51.


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