Problem with my command !
#1

Hi guys !

I have a problem with this command:

Код:
	   printf("%d",PlayerInfo[playerid][pKills]);
	   printf("%d",PlayerInfo[playerid][pDeaths]);
	   printf("%f",PlayerInfo[playerid][pKills] /= PlayerInfo[playerid][pDeaths]);
Appaer:

Quote:

2
8
0

So there must be:

Quote:

2
8
0.25

What is the problem ?

Cordially.
Reply
#2

Remove the = after /
Reply
#3

That still won't give a precise result as far as I know.

Use floatdiv, for example:
pawn Код:
printf("%.2f", floatdiv(PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]));
Reply
#4

Quote:
Originally Posted by AndreT
Посмотреть сообщение
That still won't give a precise result as far as I know.

Use floatdiv, for example:
pawn Код:
printf("%.2f", floatdiv(PlayerInfo[playerid][pKills], PlayerInfo[playerid][pDeaths]));
Nice man, thanks you
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)