float converting
#1

how would i convert a float to 1.decimal places if the float is 1000 or more

e.g

1000 - 1.points
2000 - 2.etc
3000 - 3.etc
Reply
#2

pawn Код:
if(floatcmp(MyFloat,1000.0) == 1)
{
    format(string,sizeof(string),"my float at 1 decimal place: %.1f",MyFloat);
    SendClientMessageToAll(COLOUR,string);
}
Reply
#3

not 1 decimal place, 1 before the decimal
Reply
#4

I think I understand, but maybe not
try using this and then rounding it off.
(x - (x - 1000)/10)+100

so if x = 1129 it'd be 112
Reply
#5

but if i round it off it'll become an integer? i want it like 1.54 km if that explains it better lol
Reply
#6

oh so instead of say 1928 you want it to be 1.928? if it's greater than 1000 then just divide by 1000
new Float:MyFloat;
MyFloat = MyDecimal/1000;
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)