Jump to content
McKay Development
EaGLE

Get player steam level with color

Recommended Posts

client.getSteamLevels([steamID], function (results) {
            var lvl = results % 100;
            if (lvl >= 0 && lvl <= 9) {
                gray
            } else if (lvl >= 10 && lvl <= 19) {
                red
            } else if (lvl >= 20 && lvl <= 29) {
                orange
            } else if (lvl >= 30 && lvl <= 39) {
                yellow
            } else if (lvl >= 40 && lvl <= 49) {
                green
            } else if (lvl >= 50 && lvl <= 59) {
                blue
            } else if (lvl >= 60 && lvl <= 69) {
                purple
            } else if (lvl >= 70 && lvl <= 79) {
                pink
            } else if (lvl >= 80 && lvl <= 89) {
                idk
            } else if (lvl >= 90 && lvl <= 99) {
                idk
            }
        }

 

Share this post


Link to post
Share on other sites
                       //    0         10        20            30            40          50        60         70      80           90    
    let colors = ["Gray""Red""Orange""Yellow""Green""Blue""Lilac""Pink""Cherry""Brown"];
 
    client.on("friendMessage", (SENDERMSG=> {
        client.getSteamLevels([SENDER], (ERRCURRENTLEVEL=> {
            if (!ERR) {
                console.log("The color of your level is " + colors[Math.floor(CURRENTLEVEL[SENDER] % 100 / 10)]);
            }
        });
    });

Share this post


Link to post
Share on other sites
1 hour ago, PonyExpress said:
                       //    0         10        20            30            40          50        60         70      80           90    
    let colors = ["Gray""Red""Orange""Yellow""Green""Blue""Lilac""Pink""Cherry""Brown"];
 
    client.on("friendMessage", (SENDERMSG=> {
        client.getSteamLevels([SENDER], (ERRCURRENTLEVEL=> {
            if (!ERR) {
                console.log("The color of your level is " + colors[Math.floor(CURRENTLEVEL[SENDER] % 100 / 10)]);
            }
        });
    });

can you explain it..please? i do not know what kind of api or package you are using or what does the code mean

Share this post


Link to post
Share on other sites

In this code, we just get the last 2 digits of the level, divide it by 10, and round to a smaller one. (example: level 789 = 89 / 10 = 8.9 = 8 = cherry)

It does not require special api / packages.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...