From 467606f6a6c4b0ec63cb5b5bd3917deed0538571 Mon Sep 17 00:00:00 2001 From: CosminPerRam Date: Sun, 9 Feb 2025 19:32:18 +0200 Subject: [PATCH] fix(gta5f): wrap query of players in a catch (#674) * feat: wrap query of players in a catch * docs: add note about how to make players query get through * docs: update CHANGELOG.md * docs: add comment regarding adding requestPlayers and requestPlayersRequired eventually --- CHANGELOG.md | 1 + GAMES_LIST.md | 5 ++++- lib/games.js | 3 ++- protocols/fivem.js | 5 +++-- 4 files changed, 10 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index b31ee53..95802d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ## To Be Released... ## 5.X.Y * Docs: Arma Reforger query setup note (#670, thanks @xCausxn) +* Fix: Grand Theft Auto V - FiveM wrap the players query in a try block as it doesn't provide the data by default anymore (#674, thanks @xCausxn) ## 5.2.0 * Fix: Palworld not respecting query output players schema (#666) diff --git a/GAMES_LIST.md b/GAMES_LIST.md index 5e455b5..8204176 100644 --- a/GAMES_LIST.md +++ b/GAMES_LIST.md @@ -143,7 +143,7 @@ | goldeneyesource | GoldenEye: Source | [Valve Protocol](#valve) | | groundbreach | Ground Breach | [Valve Protocol](#valve) | | gta5am | Grand Theft Auto V - alt:V Multiplayer | [Notes](#gta5am) | -| gta5f | Grand Theft Auto V - FiveM | | +| gta5f | Grand Theft Auto V - FiveM | [Notes](#gta5f) | | gta5r | Grand Theft Auto V - RageMP | [Notes](#gta5r) | | gtasam | Grand Theft Auto: San Andreas Multiplayer | | | gtasamta | Grand Theft Auto: San Andreas - Multi Theft Auto | | @@ -535,3 +535,6 @@ The query is done via the lightweight query option but also safely tries to util ### Soldat Requires `Allow_Download` and `Logging` to be `1` in the server config. + +### Grand Theft Auto V - FiveM +Requires the `sv_exposePlayerIdentifiersInHttpEndpoint` convar to be `1` for the query to return players' data. diff --git a/lib/games.js b/lib/games.js index 5aedecb..81f6bdf 100644 --- a/lib/games.js +++ b/lib/games.js @@ -1303,7 +1303,8 @@ export const games = { protocol: 'fivem' }, extra: { - old_id: 'fivem' + old_id: 'fivem', + doc_notes: 'gta5f' } }, gta5r: { diff --git a/protocols/fivem.js b/protocols/fivem.js index 377c041..460275b 100644 --- a/protocols/fivem.js +++ b/protocols/fivem.js @@ -20,7 +20,8 @@ export default class fivem extends quake2 { if ('version' in state.raw.info) state.version = state.raw.info.version } - { + try { + // TODO: #674, eventually add `requestPlayers` and `requestPlayersRequired`. const json = await this.request({ url: 'http://' + this.options.address + ':' + this.options.port + '/players.json', responseType: 'json' @@ -29,6 +30,6 @@ export default class fivem extends quake2 { for (const player of json) { state.players.push({ name: player.name, ping: player.ping }) } - } + } catch (_) {} } }