SA-MP Forums Archive
Is it possible....? - 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: Is it possible....? (/showthread.php?tid=371633)



Is it possible....? - Johnson_Brooks - 24.08.2012

Is it possible to make a kill/death ratio system?
Today i tried to do something similar but i ["COLOR=RED"]FAILED[/"COLOR"]
Anyways could somebody give me an idea or if its possible give me an example of a K/D System?


Respuesta: Is it possible....? - [DOG]irinel1996 - 24.08.2012

Probably your kills/deaths variables are integers. So:
pawn Код:
new Float:rat;
rat = float(YourKillsVariable[playerid])/float(YourDeathsVariable[playerid]);

//---A way to print it:
format(array,sizeof(array),"Your ratio: {FF0000}%.2f",rat);
//%.2f because if you get. 1.5999999 that will print just 1.59
Good luck!


Re: Is it possible....? - Johnson_Brooks - 24.08.2012

Thank you
+rep.