Why does it show as 0.000000 - 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: Why does it show as 0.000000 (
/showthread.php?tid=314987)
Why does it show as 0.000000 -
Kyle_Olsen - 01.02.2012
Hi.
I've got a small mathematical thing in my script, but of some reason it doesn't work as I want it to.
pawn Код:
new Float:newfloat;
newfloat = ( final_speed_int / 3600 ) * 2;
final_speed_int works perfectly, showing the speed of the vehicle.
However, newfloat just shows 0.000000
Why does it do that?
Any solutions?
Re: Why does it show as 0.000000 -
TTJJ - 01.02.2012
Hi Kyle,
I think doing it this way may solve your issue:
pawn Код:
new Float:newfloat;
new Float:final_speed_int_float = final_speed_int;
newfloat = (final_speed_int_float / 3600.0) * 2.0;
I had a similar issue a while ago, pretty sure thats how I fixed it.
Cheers,
TJ
Re: Why does it show as 0.000000 -
Kyle_Olsen - 01.02.2012
I'll try that, thank you.
Re: Why does it show as 0.000000 -
Konstantinos - 01.02.2012
Actually, the
final_speed_int is in float or integer?
Re: Why does it show as 0.000000 -
Kyle_Olsen - 01.02.2012
Thank you, that solved it.