Jump to content
McKay Development

get accountData from the player that writes me (node-globaloffensive)


Recommended Posts

Posted (edited)

Hey, 

im pretty new to JS and i don't know on how to get the accountData from a specific user.  i know that this works, but it just gets me the accountData of my logged in account.

 

csgo.on('accountData', (accountData) => {
    console.log(accountData);
    console.log(accountData.player_level);
});

How would i make a function to call the accountData of a specific player? Like if someone writes the bot stats it gets the accountData from the player that requested it.

 

 

Edited by Tom
Posted

Got it running if anyone else needs it 

user.on('friendMessage', (steamID, message) => {
    if (message == 'stats') {
        if (csgo.haveGCSession) {
            const steamid = new SteamID(steamID.toString());
            const final = steamid.accountid.toString();
            csgo.requestPlayersProfile(steamid, function(data) {
                // console.log(data);
                user.chatMessage(steamID, 'Wins in Matchmaking: ' + data.ranking.wins + '\n' + 'Wins in Wingman: ' + data.rankings[0].wins + '\n' + 'Wins in Dangerzone: ' + data.rankings[1].wins);
            });
        }else {
            user.chatMessage(steamID, 'Nö');
        }
    }
});

 

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...