03.06.2016, 11:23
2 ways I can think of.
1)
You may have noticed {i} that the silent speficier that ignores the first integer before dot which is 2555 in our case. "p" specifier splits with delimiter (inside <delimiter_here>) which is dot.
sscanf is recommended.
2)
1)
pawn Код:
new
Float: a = 2555.140211,
b[16],
c;
format(b, sizeof b, "%f", a);
sscanf(b, "p<.>{i}i", c);
// c = 140211
sscanf is recommended.
2)
pawn Код:
new
Float: a = 2555.140211,
b[16],
c;
a = floatfract(a); // a = 0.140211
format(b, sizeof b, "%f", a);
c = strval(b[2]);
// string b[2] is "140211"
// c = 140211