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