Giter VIP home page Giter VIP logo

node-csgo's People

Contributors

ammaraskar avatar cryptodescriptor avatar devsaider avatar hacktoberfest-acc avatar joshuaferrara avatar mshi avatar muratsu avatar ovr avatar rchh avatar step7750 avatar thecatontheflat avatar thesupremecommander avatar truecarry avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

node-csgo's Issues

SharecodeDecoder not working

The sharecode decover is not working for me:

`

var Steam = require('steam');
var csgo = require('csgo')

var steamClient = new Steam.SteamClient();
var steamUser = new Steam.SteamUser(steamClient);
steamClient.connect();
steamClient.on('connected', function() {
steamUser.logOn({
account_name: 'redacted',
password: 'redacted'
});
});

steamClient.on('logOnResponse', function() {
steamGC = new Steam.SteamGameCoordinator(steamClient, 730);
CSGO = new csgo.CSGOClient(steamUser, steamGC, false);

console.log(CSGO.SharecodeDecoder("CSGO-U6MWi-hYFWJ-opPwD-JciHm-qOijD").decode());
});

`

this results in
image

After few hours of running bot died on connection status

I'm not sure why GCConnectionStatus is undefined, but it doesn't appearing in CSGO scope.

/home/csgo/node_modules/csgo/index.js:121
    case CSGO.GCConnectionStatus.GCConnectionStatus_HAVE_SESSION:
                                ^
TypeError: Cannot read property 'GCConnectionStatus_HAVE_SESSION' of undefined
    at CSGOClient.gcClientConnectionStatus (/home/csgo/node_modules/csgo/index.js:121:33)
    at SteamClient.fromGC (/home/csgo/node_modules/csgo/index.js:32:30)
    at SteamClient.emit (events.js:118:17)
    at SteamClient.handlers.(anonymous function) (/home/csgo/node_modules/steam/lib/handlers/game_coordinator.js:59:13)
    at SteamClient._netMsgReceived (/home/csgo/node_modules/steam/lib/steam_client.js:106:26)
    at SteamClient.handlers.(anonymous function) (/home/csgo/node_modules/steam/lib/steam_client.js:192:10)
    at SteamClient._netMsgReceived (/home/csgo/node_modules/steam/lib/steam_client.js:106:26)
    at Connection.emit (events.js:107:17)
    at Connection._readPacket (/home/csgo/node_modules/steam/lib/connection.js:50:8)

Get match details from requestCurrentLiveGames

Through requestCurrentLiveGames I only can gather match_id, I would like to wait for them to wait and download its replay. Is there a way to get outcomeId and tokenId from those matches? Its easy to wait for them to end, but I don't know how to get the token or the outcome

examples question and getting started

Hi , so I want to get started with this repo to make a website for csgo that pulls certain information from the game/player.

I'm having a hard time getting started. While the documentation on the readme is superb, there's isn't enough for someone new to get started.

I saw there was an example.js, but none of it is commented, and its using a lot of stuff not mentioned in the readme. Even when I run the example.js, after setting my username and password, it asks for an auth code, and no where in there does it specify how to get an auth code.

Basically, if I'm a web developer and all I want to do is pull off some user data what's the best way to do that, Can someone provide me with a full code snippet on something that works, so I can get started? I couldn't find any tutorials online for this specific repo.

Please don't get mad if this seems like a dumb post, I'm just trying to get started :)

playerProfile event never triggered

this is my code:

csgo.launch();
csgo.playerProfileRequest(AccountID);
csgo.on('playerProfile',function(profiles) {
	console.log("playerProfile received");
});

console never log the "playerProfile received".

demo download

Hey man this looks like a sweet project. I really want some api that will let me automatically download my recent demos from matchmaking. Have you thought about adding the demo list to this?

How to get sharecode for a given match?

I think I've figured out how to extract the matchId and the reservationId of the last round which I assume to be the outcomeId, but I have no clue how to get the token. I dumped the entire match into a file and tried to search for token or even the token I manually extracted from one sharecode but neither found anything.

I also failed to find the sharecode encoder if such a thing exists.

Prime status?

Hi, would it be possible to find the prime status of a given user?

requestRecentGames game_map is always null

This is probably not an issue with node-csgo itself, but I figured this would still be the best place to post to get an answer.

The matchList response from requestRecentGames never seems to populate game_type, game_mapgroup and game_map. Is that just how it is?

It seems a bit strange considering the map names are displayed in game on the "Your Matches" page.

Thanks,


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

setGameName

What's the correctly way to make a Non Steam Game visible?
I've tried:

bot.gamesPlayed(["test name", 730]);

And

bot.setGameName(["teste"]);

Still shows CS:GO as currently game running.

Matches array is always empty when using requestGame()

I am using this snippet for testing:

steamFriends.setPersonaState(steam.EPersonaState.Busy);

const counterstrike = new csgo.CSGOClient(steamUser, steamCoordinator, false);

counterstrike.launch();

const decode = new csgo.SharecodeDecoder(sharecode);

counterstrike.on('ready', () => {
    counterstrike.requestGame(decode.matchId, decode.outcomeId, decode.tokenId);
});

counterstrike.on('matchList', (matchResponse) => {
    console.log(JSON.stringify(matchResponse));
});

which always returns

{
  "msgrequestid": 0000,
  "accountid": 000000000,
  "servertime": 0000000000,
  "matches": [],
  "streams": [],
  "tournamentinfo": null
}

Am I doing something wrong? The matches are always very recent (A few hours ago) - so they should definitely be returned? Or am I missing something?

Implement an 'exited' event

The 'unready' event on CSGO only triggers on unexpected interruptions to the GC connection. Currently, there is no specific event that triggers on CSGO.exit().

The README may lead one to believe that it is recommended practice to remove any event listeners on the unready event -- yet, that doesn't account for intentional exits. An exited event would be ideal here.

How can I get infos from matches?

Hey guys,
Basicaly I want to get infos from the matches that my own cs:go servers will do... Infos like: kills, deaths, assists, etc...

I heard about that Valve let we do a request each 60 seconds to pull those infos to my website?

Thank soo much guys!

Cannot connect, stuck at "Sending ClientHello"

SInce the gitter chat appears to be dead, I decided to open an issue on matter.

The node steam module successfully connects and logs in, however, after CSGOClient.launch(), it is stuck in a loop constantly trying to send ClientHello, and doesn't move from there.

Unable to turn json back into proto objects

I'm having a problem with turning the json response back into protos.

This worked earlier with the bundled protos in v1.5.7.

What im trying to do is to be able to create the dem.info files so that i keep the same format that downloading manually from csgo does.

So what im doing is to take the matchList response, taking out the match in that list trying to create a proto object with it.

if you check out this repo i've created a demo that showcases the error, https://github.com/ajohnsen/node-csgo-proto-encode-error

if you download that and run 'STEAM_USERNAME= STEAM_PASSWORD= npm start' it will run the demo and request a game from a sharecode. And then when the matchList response comes in it tries to create the dem.info file, but fails when trying to make the proto file.

If you take a look at works.js (run with 'npm works') this will read match.dem.info and decode it into a json object, before it turns it back into a protobuf object and writes it to a new file (new.dem.info).

You can check that these files are the same with md5

The only difference i see in the json is that the one that is not working is missing the tv_control and flags attribute from roundstatall[].reservation, and that the last roundstatall[].map is null on the working one and has the download link on the non working one.

Edit: even if i add the missing flags and make the json completely different (using JSON.strigify and comparing with jsondiff.com) i still only get the problem with one of them. Even if i do it in the same file.

The error message im getting is:
Error: Illegal value for [object Object] of type uint64: object (not convertible to Long) at line 1769 in Protobuf.js

Edit 2: From my digging around in protobuf.js it looks like its trying to read the Long value for matchId by parsing the entire json object as the long value and failing.

Stuck at Sending ClientHello

I have basically same issue as discussed in recently closed #80
When I try to launch node-csgo it gets stuck at Sending ClientHello, never firing ready event.

My code: https://pastebin.com/H9fCSubE
It's more or less just the example script.

Output:

Username: ******************
Password: ********************
31 Jan 23:59:37 - Logged in!
31 Jan 23:59:37 - Logged on.
31 Jan 23:59:37 - Launching CS:GO
31 Jan 23:59:37 - Received servers.
31 Jan 23:59:40 - Sending ClientHello
31 Jan 23:59:42 - Sending ClientHello
31 Jan 23:59:45 - Sending ClientHello
31 Jan 23:59:47 - Sending ClientHello
31 Jan 23:59:50 - Sending ClientHello
31 Jan 23:59:52 - Sending ClientHello
31 Jan 23:59:55 - Sending ClientHello
31 Jan 23:59:57 - Sending ClientHello
1 Feb 00:00:00 - Sending ClientHello
1 Feb 00:00:02 - Sending ClientHello
1 Feb 00:00:05 - Sending ClientHello
1 Feb 00:00:07 - Sending ClientHello

However node-dota2 works fine.


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Problem with friend and playerProfileRequest

Hello

I have a problem with event friend and getting player.

My friend event:

steamFriends.on('friend', function(userId, relationship) { 
    if (relationship == 2 && !_.contains(secrets.blacklist, userId)) {
        steamFriends.addFriend(userId);

        setTimeout(function() {
            steamFriends.sendMessage(userId, 'Hello');
            setTimeout(function() {
                CSGO.playerProfileRequest(CSGO.ToAccountID(userId));
                CSGO.on("playerProfile", function(profile) {
                   steamFriends.sendMessage(userId, 'test');
                });
            }, 2000);
        }, 3000);
    }
});

and when I first time add bot he send me: Hello and test, but when I remove him and add again he send me Hello, test, test.
If I again remove and add him he send me Hello, test, test, test

Why? How can I get fix it?

Cannot get watchablematchinfo from matchList

hi, when I use CSGO.requestGame(), providing all the parameter that I get from SharecodeDecoder, in the matchList response I can find the match with all the information for every round but I cannot get the watchablematchinfo like game_type, game_mapgroup, game_map because they are assigned to null.
screenshot


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

About the number on richPresenceUpload

According to the console command "version", that value is the Protocol version, which (at least at the current update) is the same as the EXE version but without points.

So maybe it's required to make sure that the client is on the latest version?

Here's what the current "version" looks like:

Protocol version 13504
Exe version 1.35.0.4 (csgo)
Exe build: 17:12:46 Sep 30 2015 (6171) (730)

This is not really an issue (apart from the fact that the example is now outdated (13503 instead of 13504), just some info on the number.

TypeError: Cannot read property 'send' of undefined

var Steam = require('steam'),
    steamClient = new Steam.SteamClient(),
    steamUser = new Steam.SteamUser(steamClient),
    steamGC = new Steam.SteamGameCoordinator(steamClient, 730),
    csgo = require('csgo'),
    CSGO = new csgo.CSGOClient(steamUser, steamGC, true);

module.exports.login = async (user, password) => {
    CSGO.launch();
}

29 Apr 22:18:03 - Launching CS:GO (node:4528) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'send' of undefined at SteamClient._send (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Cyberpunk 2077\Desktop\VertBob\node_modules\steam\lib\steam_client.js:117:20) at SteamClient.send (C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Cyberpunk 2077\Desktop\VertBob\node_modules\steam\lib\steam_client.js:126:8)

Tried node V12 and V14

requestGame() returns null

var Steam = require('steam'),
    steamClient = new Steam.SteamClient(),
    steamUser = new Steam.SteamUser(steamClient),
    steamGC = new Steam.SteamGameCoordinator(steamClient, 730),
    csgo = require('csgo'),
    CSGO = new csgo.CSGOClient(steamUser, steamGC, false);

var decoded = new csgo.SharecodeDecoder("CSGO-7UvAK-FD3Ac-8DeTA-74ZUK-9Sm6J").decode();
console.log(decoded);
var requestinfo = CSGO.requestGame(decoded.matchId, decoded.outcomeId, decoded.tokenId);
console.log(requestinfo);

requestGame() returns null :(
screenshot_3

Request game info

Do you think there's a way when we can use

message CMsgGCCStrike15_v2_MatchListRequestFullGameInfo {
    optional uint64 matchid = 1;
    optional uint64 outcomeid = 2;
    optional uint32 token = 3;
}

?
I'm trying to make it work, but I have no matches in reponse. I think outcomeid is id of last round, but I have no clue what token value should be.

requestRecentGames is working ?

Hello !

I can't manage to make requestRecentGames working. I made this code. Is it wrong ? Or maybe Valve disable it (like the other one) ?

Thanks.

(Code)

async function getMatchesFor(steamid) {
    console.log("* sending request");
    var res_cs = csgo.requestRecentGames(steamid);
    console.log("* request method returned "+res_cs);
    while(received_matchs_infos == null) {
        console.log("* waiting because no response");
        await sleep(1000);
    }
    console.log("* got return value");
    val = received_matchs_infos;
    received_matchs_infos = null;
    return val;
}
// I use this function after receiving loggedOn event (and after connectedToGC event)

Event playerProfile problem

Hello

Im on event "friend" from node-steam call:
CSGO.playerProfileRequest(CSGO.ToAccountID(sid));
CSGO.on("playerProfile", function(profile) {
//get player profil info
}

I have a problem when check first friend is ok, but when I add second friend "playerProfile" is calling two times for first and second friend.

How can I fix it?

Unable to request player profiles multiple times

I'm currently unable to request profiles for multiple players as the 'playerProfile' event only gets fired once.
This happens both when quickly requesting player profiles (in a loop) and waiting to request the next one until the previous one has been received.

EDIT: It suddenly worked.

Error when starting

When I do node example.js, I get the following error:

error, { eresult: 5,
eresult_extended: 5,
client_supplied_steamid: 'xxxxxxxxxxx',
count_loginfailures_to_migrate: 0,
count_disconnects_to_migrate: 0 }

gamesPlayed

Hi ! Don't know if the project is supposed to be up to date but it seems the launch of CS GO is broken :

.CMsgClientGamesPlayed.GamePlayed#games_played is not a Field

I fixed the issue changing

this._user.gamesPlayed({
    games_played: [{game_id: '730'}]
});

to

this._user.gamesPlayed([{game_id: '730'}]);

in index.js

node-steam connect socket timeout

Unable to connect SteamClient to steam servers

Debug:
connecting to 162.254.196.41:27017
socket timed out
socket closed
connecting to 162.254.196.40:27020
socket timed out
socket closed

Sometimes PlayerProfileRequest return ranking: null

Sometimes, i don't know why it returns this

{ request_id: null,
  account_profiles:
   [ { account_id: 152304352,
       ongoingmatch: null,
       global_stats: null,
       penalty_seconds: null,
       penalty_reason: null,
       vac_banned: null,
       ranking: null,
       commendation: [Object],
       medals: [Object],
       my_current_event: null,
       my_current_event_teams: [],
       my_current_team: null,
       my_current_event_stages: [],
       survey_vote: null,
       activity: null,
       player_level: 20,
       player_cur_xp: 327680966,
       player_xp_bonus_flags: null } ] }

Any idea why i can't get the rank ?
Ty


Want to back this issue? Post a bounty on it! We accept bounties via Bountysource.

Version 1.5.13 is broken because of steam-resources

steam-resources has a prepare script in their package.json that uses svn to clone stuff on installation.

When I try to do a fresh installation without node_modules it fails to install. Not every server has svn installed on their machines...

node-csgo unready

I keep get this message ,
GC Connection went missing, exiting node-csgo unready

playerProfile keeps the same data for every user.

Hello. Me and my friend are trying to do a simple app that would take all the steam64ids from mysql and then use the id in playerProfileRequest.

`var j = schedule.scheduleJob('*/5 * * * * *', function(){
var array = [];

con.query("SELECT * FROM counterStrikeGlobalOffensive", function (err, rows) {
	for (var i = 0; i < rows.length; i++) {
		console.log(rows[i].steam64ID);
		CSGOCli.playerProfileRequest(CSGOCli.ToAccountID(rows[i].steam64ID));
		CSGOCli.on("playerProfile", function(profile) {
			console.log(profile.account_profiles[0].ranking.rank_id);
			return;
		});
	}
});

return;
});`

This is where my problem begins. When I do console.log(rows[i].steam64ID, it returns all of the ids that are in the mysql. Then I put the id in playerProfileRequest and then when I do console.log(profile), it keeps repeating the same data for each steamid.

playerProfileRequest mainly returns null and readCString error

Since the start of using the 'package', I've been trying to recieve player profile information; however, all requests no matter what valid accoundID provided returns null for the majority of the fields:

{
  "request_id": null,
  "account_profiles": [
    {
      "account_id": 396346719,
      "ongoingmatch": null,
      "global_stats": null,
      "penalty_seconds": null,
      "penalty_reason": null,
      "vac_banned": null,
      "ranking": null,
      "commendation": {
        "cmd_friendly": 19,
        "cmd_teaching": 16,
        "cmd_leader": 18
      },
      "medals": {
        "medal_team": null,
        "medal_combat": null,
        "medal_weapon": null,
        "medal_global": null,
        "medal_arms": null,
        "display_items_defidx": [
          4674,
          970,
          1367
        ],
        "featured_display_item_defidx": 4674
      },
      "my_current_event": null,
      "my_current_event_teams": [],
      "my_current_team": null,
      "my_current_event_stages": [],
      "survey_vote": null,
      "activity": null,
      "player_level": 14,
      "player_cur_xp": 327681231,
      "player_xp_bonus_flags": null
    }
  ]
}

The logs return:

13 Dec 23:37:01 - Launching CS:GO
13 Dec 23:37:03 - Sending ClientHello
13 Dec 23:37:03 - CS:GO fromGC: 4004
13 Dec 23:37:03 - Received client welcome.
13 Dec 23:37:03 - Sending player profile request
13 Dec 23:37:04 - CS:GO fromGC: 9173
13 Dec 23:37:04 - CS:GO fromGC: 9128
13 Dec 23:37:04 - Received player profile

Can confirm CS GO is running, as it established a successful connection and:
ur5U


In addition, I've had the client crash to a random error:

/root/**********/node_modules/csgo/helpers/VDF.js:28
            var name = buffer.readCString();
                              ^

TypeError: buffer.readCString is not a function
    at Object.exports.decode (/root/**********/node_modules/csgo/helpers/VDF.js:28:31)
    at CSGOClient.handlers.<computed> (/root/**********/node_modules/csgo/handlers/rich_presence.js:44:20)
    at SteamClient.<anonymous> (/root/**********/node_modules/csgo/index.js:50:30)
    at SteamClient.emit (events.js:326:22)
    at SteamClient._netMsgReceived (/root/**********/node_modules/steam/lib/steam_client.js:175:10)
    at SteamClient.handlers.<computed> (/root/**********/node_modules/steam/lib/steam_client.js:262:10)
    at SteamClient._netMsgReceived (/root/**********/node_modules/steam/lib/steam_client.js:160:26)
    at Connection.emit (events.js:314:20)
    at Connection._readPacket (/root/**********/node_modules/steam/lib/connection.js:50:8)
    at Connection.emit (events.js:314:20)
    at emitReadable_ (_stream_readable.js:557:12)
    at processTicksAndRejections (internal/process/task_queues.js:83:21)

Can provide more information if needed!

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.