SA-MP Forums Archive
Problem with my command ! - Printable Version

+- SA-MP Forums Archive (https://sampforum.blast.hk)
+-- Forum: SA-MP Scripting and Plugins (https://sampforum.blast.hk/forumdisplay.php?fid=8)
+--- Forum: Scripting Help (https://sampforum.blast.hk/forumdisplay.php?fid=12)
+--- Thread: Problem with my command ! (/showthread.php?tid=334759)



Problem with my command ! - jcvag44800 - 15.04.2012

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.


Re: Problem with my command ! - iRage - 15.04.2012

Remove the = after /


Re: Problem with my command ! - AndreT - 15.04.2012

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]));



Re : Re: Problem with my command ! - jcvag44800 - 15.04.2012

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