Why does it show as 0.000000
#1

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?
Reply
#2

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
Reply
#3

I'll try that, thank you.
Reply
#4

Actually, the final_speed_int is in float or integer?
Reply
#5

Thank you, that solved it.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)