The online racing simulator
Km Distance Rule
Hello guys !

I have a problem with a Km distance rule

Here my code

InSim.Send_BTN_CreateButton("^7" + Connections[GetConnIdx(Players[GetPlyIdx(MCI.Info[i].PLID)].UniqueID)].TotalDistance / 1000, Flags.ButtonStyles.ISB_C2, 4, 12, 145, 3, 162, (Connections[GetConnIdx(Players[GetPlyIdx(MCI.Info[i].PLID)].UniqueID)].UniqueID), 2, false);

This shows my driven KM´s so :

KM: 6

so now i want to have its so :

KM: 6,1
KM: 6,2

i have used the code so this time : TotalDistance / 1000d
thats is a big fail because the d stands for double......

So i dont want hes
thats show me now :

KM: 6,232

Can everywhere help me please ?

SORRY FOR MY VERY BAD ENGLISH
Been a while for me on this but ToString() will convert a double to less decimal places. the "N1" means 1 decimal place IIRC.


a = 3.532545453
a.ToString("N1")
evaluates to 3.5


hm....
^^ thanx but this dont helps me.....

I think i must change anything on TotalDistance 1000 /

I have used TotalDistance 1000.0 /
than 1000 / 0.1
and much more i dont know.......

i want to show my driven km are in two words .....

is is now : KM BUTTON ON LFS: [ 6,345 ] KM
i wants so.. KM BUTTON ON LFS: [ 6,3 ] KM

hm...

i hope any one can understand me......
#4 - Silox
round(variable, 2) ?
......


Sry doesnt work......

i dont want to begging......

can anywhere please make me a code for this ?

here is my code again.....
and it show my driven Km likes Km: 6
and i wants to have it so Km: 6,1
please dont give me a code this looking so Km: 6,100 :ashamed:



InSim.Send_BTN_CreateButton("^7" + Connections[GetConnIdx(Players[GetPlyIdx(MCI.Info[i].PLID)].UniqueID)].TotalDistance / 1000, Flags.ButtonStyles.ISB_C2, 5, 15, 145, 6, 162, (Connections[GetConnIdx(Players[GetPlyIdx(MCI.Info[i].PLID)].UniqueID)].UniqueID), 2, false);


Sry about this all.....
I says thanx ..... the problem is i undstand this
where i must take it ?
i dont have anything of string.format..... in my insim



string.Format("{0:0}", totalDistance); // Round to 1 decimal place

InSim.Send_BTN_CreateButton("^7" + string.Format("{0:0}", Connections[GetConnIdx(Players[GetPlyIdx(MCI.Info[i].PLID)].UniqueID)].TotalDistance / 1000.0), Flags.ButtonStyles.ISB_C2, 5, 15, 145, 6, 162, (Connections[GetConnIdx(Players[GetPlyIdx(MCI.Info[i].PLID)].UniqueID)].UniqueID), 2, false);

This way ?!
sry ^^ thanx i try it....


Thanx now its Working !


FGED GREDG RDFGDR GSFDG