Closed asadm closed 5 months ago
Interesting problem. Will look into this.
Any toString
s and similar data conversions should adhere to this rule. We will first update setState, test it, ensure it's working fine in Brazil and similar settings, then port it to the other functions.
Closing as completed in #30. However, it is possible that this issue lurks in more string-like places. Will keep an eye out and refer here if we find it again.
bug report:
I found the problem and a fix! It is related to a comma separator being used for real number representation in strings instead of dot separator. In my region (Brazil) comma is used instead of dot. So when the javascript tries to
parseFloat(UTF8ToString(value))
the float value gets clamped. The solution was in the C# side: In the Player class, inside the methodpublic void SetState(string key, float value, bool reliable = false)
, apply the InvariantCulture parameter when converting the float to a string, like this:SetPlayerStateFloatByPlayerId(id, key, value.ToString(System.Globalization.CultureInfo.InvariantCulture), reliable);