Problem with percentage calculation
#1

I'm trying to present a percentage in a dialog. It's the percentage of kills from your total kills and deaths.

I did:
Код:
	    new total, Float:total2;
	    total = pData[playerid][Kills] + pData[playerid][Deaths];
	    total2 = pData[playerid][Kills] / total;

	    format(tmp, 120, "{FFFFFF}You've killed {8CFF00}%d {ffffff}times and died {8CFF00}%d {FFFFFF}times, giving you a kill rate of %d%%,\n", pData[playerid][Kills], pData[playerid][Deaths], floatround(total2));
	    strcat(str, tmp);
But in the dialog is just shows as 0%, even though my kills and deaths are set as 234 and 76.
Reply
#2

Use float()
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)