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

Why does this top10 not show top20?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
blood2k
Senior Member
Join Date: Mar 2014
Old 08-06-2018 , 15:52   Why does this top10 not show top20?
Reply With Quote #1

Code:
// Get and format top 15.
format_top15( id, sBuffer[MAX_BUFFER_LENGTH + 1])
{
	new iMax = get_statsnum()
	new izStats[8], izBody[8]
	new iLen = 0

	if (iMax > 10)
		iMax = 10

	new istate[2]

	new top_name[64]
	format ( top_name, sizeof ( top_name ) - 1, "%L", id, "HTML_PLAYER_TOP" )
	iLen = format ( sBuffer, MAX_BUFFER_LENGTH, "%L%L", id, "HTML_TOP_BODY", top_name, id, "HTML_TOP_HEADER" )

	for (new i = 0; i < iMax && MAX_BUFFER_LENGTH - iLen > 0; i++)
	{
		if (equali(istate, "a"))
			copy(istate, sizeof(istate)-1, "b")
		else
			copy(istate, sizeof(istate)-1, "a")
		get_stats(i, izStats, izBody, t_sName, MAX_NAME_LENGTH)
		replace_all(t_sName, MAX_NAME_LENGTH, "<", "[")
		replace_all(t_sName, MAX_NAME_LENGTH, ">", "]")
		iLen += format(sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L", id, "HTML_TOP_TABLE", istate, i+1, t_sName, izStats[STATS_KILLS],
						izStats[STATS_DEATHS], izStats[STATS_HITS], izStats[STATS_SHOTS], izStats[STATS_HS], effec(izStats), accuracy(izStats))
	}
	iLen += format ( sBuffer[iLen], MAX_BUFFER_LENGTH - iLen, "%L", id, "HTML_CLOSE" )
}


I changed the 2 iMax that say 10, to 20... but it then shows 13 players and 13th has no stats... how do I get this to show 20? :/
blood2k is offline
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 08-06-2018 , 21:01   Re: Why does this top10 not show top20?
Reply With Quote #2

sBuffer[] may be too small
__________________
Bugsy is online now
blood2k
Senior Member
Join Date: Mar 2014
Old 08-06-2018 , 22:01   Re: Why does this top10 not show top20?
Reply With Quote #3

What's a good value?
blood2k is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-07-2018 , 17:10   Re: Why does this top10 not show top20?
Reply With Quote #4

Quote:
Originally Posted by blood2k View Post
What's a good value?
To make it easy, double whatever you had previously.
You do however have a limit in the MOTD of 1536 characters which you probably will hit. In order to work around that you'll have to print everything to a local file and link the MOTD to the file instead of supplying it a string.

I think it's as easy as this, haven't tested it thought.
Code:
show_motd(id, sBuffer);
->
Code:
new hFile = fopen("top20.htm", "w"); fputs(hFile, sBuffer); fclose(hFile); show_motd(id, "top20.htm");
__________________

Last edited by Black Rose; 08-07-2018 at 17:10.
Black Rose is offline
sb123
Senior Member
Join Date: Jan 2007
Old 08-08-2018 , 06:30   Re: Why does this top10 not show top20?
Reply With Quote #5

Build a "HTM" folder under the "cstrike" folder, put "top15.htm" in this "HTM" folder, open "top15.htm" with Notepad or other text editing software, and change the address behind the URL in the inside to the URL address of someone who can access the "top15_result.htm" file. (Note: "top15_result.htm" files are generated by the plug-in)

Using this plug-in's TOP15, you need to open the Web service in your server and use the "HTM" folder as the root address of your Web server or a virtual directory in it. The contents of Web services are not discussed here. Here is no introduction. Please check the data yourself. Build a "HTM" folder under the "cstrike" folder, put "top15.htm" in this "HTM" folder, open "top15.htm" with Notepad or other text editing software, and change the address behind the URL in the inside to the URL address of someone who can access the "top15_result.htm" file. (Note: "top15_result.htm" files are generated by the plug-in)

Using this plug-in's TOP15, you need to open the Web service in your server and use the "HTM" folder as the root address of your Web server or a virtual directory in it. The contents of Web services are not discussed here. Here is no introduction. Please check the data yourself.
Attached Files
File Type: zip statsx.zip (10.1 KB, 64 views)
__________________
sb123 is offline
Send a message via ICQ to sb123 Send a message via MSN to sb123 Send a message via Yahoo to sb123
fysiks
Veteran Member
Join Date: Sep 2007
Location: Flatland, USA
Old 08-08-2018 , 12:42   Re: Why does this top10 not show top20?
Reply With Quote #6

Quote:
Originally Posted by Black Rose View Post
To make it easy, double whatever you had previously.
You do however have a limit in the MOTD of 1536 characters which you probably will hit. In order to work around that you'll have to print everything to a local file and link the MOTD to the file instead of supplying it a string.

I think it's as easy as this, haven't tested it thought.
Code:
show_motd(id, sBuffer);
->
Code:
new hFile = fopen("top20.htm", "w"); fputs(hFile, sBuffer); fclose(hFile); show_motd(id, "top20.htm");
IIRC, the limit is still there for displaying a file. It has to do with transmitting to the player. So, the only way to bypass that limit is to host the content on a website.
__________________
fysiks is offline
Black Rose
Veteran Member
Join Date: Feb 2011
Location: Stockholm, Sweden
Old 08-08-2018 , 13:17   Re: Why does this top10 not show top20?
Reply With Quote #7

Quote:
Originally Posted by fysiks View Post
IIRC, the limit is still there for displaying a file. It has to do with transmitting to the player. So, the only way to bypass that limit is to host the content on a website.
Good to know, thanks.
__________________
Black Rose 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 14:12.


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