Raised This Month: $ Target: $400
 0% 

Percentage problem


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
mazmaajinsh
Senior Member
Join Date: Apr 2005
Location: Latvia
Old 08-15-2010 , 08:02   Percentage problem
Reply With Quote #1

Hello. I cant seem to figure out the problem, why I cant get the script to calculate percentages. You see, it should calculate number / totalnumbers * 100 , to get percentage, but it doesnt. it only shows 100, when I have reached totalnumbers. Well, if you didnt understand what I ment, just check these lines please, and I am sure you will find the mistake immediatly. I have bolded the line, that I think is the problem. Thanks

Code:
public timer_task(Float:kreedztime)
{
	if (get_pcvar_num(kz_show_timer) == 1 )
	{
		for(new i=1;i<=MaxPlayers;i++)
		{
			if (is_user_alive(i))
			{
				if( is_user_connected(i) && timer_started[i])
				{
					kreedztime = thetime() - timer_time[i]
					new nearest = get_nearest_marker(i);
					new totalmarkers = gMarkerCount

					new percent = floatround(nearest / totalmarkers * 100.0)
					new imin = floatround(kreedztime / 60.0,floatround_floor)
					new isec = floatround(kreedztime - imin * 60.0,floatround_floor)
					new colors[12], r[4], g[4], b[4];
					get_pcvar_string(kz_hud_color, colors, 11)
					parse(colors, r, 3, g, 3, b, 4)
			
					set_hudmessage(str_to_num(r), str_to_num(g), str_to_num(b), 0.40, 0.10, 0, 0.0, 1.0, 0.0, 0.0, 1)
					if ( ShowTime[i] )
						if (IsPaused[i])	
							show_hudmessage(i, "Timer is paused, type /unpause to continue")	
						else
							show_hudmessage(i, "Time: %s%d:%s%d | CPs: %d | TPs: %d | Done: %d",imin < 10 ? "0" : "",imin, isec < 10 ? "0" : "", isec, checknumbers[i], gochecknumbers[i], percent) 
		}
}
__________________
Ahujena
mazmaajinsh is offline
 



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 21:54.


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