SA-MP Forums Archive
Divide 2 floats? - 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)
+---- Forum: Help Archive (https://sampforum.blast.hk/forumdisplay.php?fid=89)
+---- Thread: Divide 2 floats? (/showthread.php?tid=224933)



Divide 2 floats? - XCarBOn - 12.02.2011

Hello,

I try to divide 2 floats, but whatever I try, it won't work. Now I've found something in SAMP-Wiki: https://sampwiki.blast.hk/wiki/Floatdiv. I tried that but it doesn't work (I get this error: Undefined symbol "floatdiv"), too. Have anyone ideas? Thanks for helping.. Oh and: I want to make a Kills/Deaths Ratio







XCarBOn


Re: Divide 2 floats? - Ash. - 12.02.2011

Erm, floatround? + then divide it by the amount of decimal places used, to get it back to float after you have divided them. I havent tried it, but it seems logical enough.

+ But using the "/" operator should work anyway.


Re: Divide 2 floats? - Hiddos - 12.02.2011

Well if you want to make a KTD ratio, you're most probably dividing the kills by the deaths:
pawn Код:
new Float:KTD = floatdiv(Kills, Deaths);



Re: Divide 2 floats? - XCarBOn - 12.02.2011

Quote:
Originally Posted by Hiddos
Посмотреть сообщение
Well if you want to make a KTD ratio, you're most probably dividing the kills by the deaths:
pawn Код:
new Float:KTD = floatdiv(Kills, Deaths);
Floatdiv won't work^^ I get an error when I use floatdiv..


Re: Divide 2 floats? - Hiddos - 12.02.2011

Then you're using it wrong. Post the error with the corresponding code.


Re: Divide 2 floats? - XCarBOn - 12.02.2011

Found the error: I've copied the example and forget the replace the "F" of float with a little "f". I knew that I've forgotten something. I'll try, Thanks!