Other than trailing zeroes being ignored, why not do it simply? Here, I'll copy your input format:
NPC Code:
//#CLIENTSIDE
if (playerchats) {
tokenize #c;
if (strequals(#t(0),dp)) {
this.num=strtofloat(#t(1));
this.maxplaces=strtofloat(#t(2));
this.newnum=int(this.num * 10^this.maxplaces + 0.5) / 10^this.maxplaces;
setplayerprop #c,#v(this.newnum);
}
}