Jump to content
McKay Development

Xaviius

Member
  • Posts

    4
  • Joined

  • Last visited

Posts posted by Xaviius

  1. Its basically what I did in the event before:

    async function matchList(matches: Array<IMatch>) {
        console.log(matches)
        if (matches[0]) {
            matches[0].roundstats_legacy.reservation.account_ids.forEach(async (accid: number) => {
                if (await monitoringRepository.findOne(SteamID.fromIndividualAccountID(accid).getSteamID64()) === undefined && await mmRepository.findOne(SteamID.fromIndividualAccountID(accid).getSteamID64()) === undefined) {
                    var steamid_db = {
                        id: SteamID.fromIndividualAccountID(accid).getSteamID64(),
                        date: new Date().toJSON().slice(0, 10)
                    };
                    searchedids.push(SteamID.fromIndividualAccountID(accid).getSteamID64());
                    mmRepository.save(steamid_db).then(() => logger.info("SteamID: " + SteamID.fromIndividualAccountID(accid).getSteamID64() + " added to matchmaking accounts."))
                        .catch((err) => logger.error(err));
                }
            });
        }
    }

    Even with once it does not work constantly. Sometimes it only works for 2 steamids and then again only for one, even though they are 8. steamids is an array of type SteamID of your other library.

  2. I already tried to use it with Promise like this:

    await new Promise((resolve) => {
    	csgoUser.on('matchList', resolve);
    })

    The first time it works and the second it awaits and never finishes... 

    the whole important code looks like this at the moment:

    for (let steamid of steamids) {
    	if (!searchedids.some((searched) => searched === steamid.getSteamID64())) {
    		csgoUser.requestLiveGameForUser(steamid.getSteamID64());
    		await matchList(await new Promise((resolve) => {
    			csgoUser.on('matchList', resolve);
    		}));
    		await sleep(1000);
    	}
    }
    steamClient.logOff();

     

  3. Hey,

    is there any possibility to repeat the requestLiveGameForUser method? If I call the method the first time it works, but the second, third... time it does not. Here is the important code:

    csgoUser.on('connectedToGC', async () => {
        searchedids = []
        for (let steamid of steamids) {
            if (!searchedids.some((searched) => searched === steamid.getSteamID64())) {
                csgoUser.requestLiveGameForUser(steamid.getSteamID64());
                await sleep(10000)
            }
        }
    });
    csgoUser.on('matchList', async (response) => {
        console.log(response);
        steamClient.logOff();
    });

    Any clue why it does not work? 

    Thank you for this awesome lib!

×
×
  • Create New...