Jump to content


Photo
Question

Get accurate CS:GO skin wear value



  • Please log in to reply
3 replies to this topic

#1 TheRedMelon

TheRedMelon

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 19 March 2019 - 03:37 PM

First of all I'm using C#, not node.js; I'm not sure where to ask so I thought I'd try here.

 

I have the 'SkinData.paintwear' value as a uint from CS:GO.  I'd like to show it as an accurate 16 decimal place value, but I can't figure out how.

So far I have:

Convert.ToDouble(BitConverter.ToSingle(BitConverter.GetBytes(client.SkinData.paintwear), 0))

But this returns only 15 decimal places, and the 15th is rounded.

How can I get the extra decimal place?



#2 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,162 posts

Posted 19 March 2019 - 09:56 PM

Get rid of the Convert.ToDouble call.



#3 TheRedMelon

TheRedMelon

    Newbie

  • Member
  • Pip
  • 2 posts

Posted 20 March 2019 - 07:13 AM

Doesn't work, 

BitConverter.ToSingle(BitConverter.GetBytes(client.SkinData.paintwear), 0)

just leaves it as a single, showing only 6 digits after the decimal point.



#4 Dr. McKay

Dr. McKay

    Developer

  • Administrator
  • 2,162 posts

Posted 20 March 2019 - 09:28 PM

The value is a single-precision float. A double will give you the wrong value. It sounds like whatever you're using to display it is truncating the number of decimals, so you should go check that.







Also tagged with one or more of these keywords: Question

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users