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
This commit is contained in:
CosminPerRam 2025-02-09 19:32:18 +02:00 committed by GitHub
parent c68db8f98b
commit 467606f6a6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 10 additions and 4 deletions

View file

@ -2,6 +2,7 @@
## To Be Released... ## To Be Released...
## 5.X.Y ## 5.X.Y
* Docs: Arma Reforger query setup note (#670, thanks @xCausxn) * 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 ## 5.2.0
* Fix: Palworld not respecting query output players schema (#666) * Fix: Palworld not respecting query output players schema (#666)

View file

@ -143,7 +143,7 @@
| goldeneyesource | GoldenEye: Source | [Valve Protocol](#valve) | | goldeneyesource | GoldenEye: Source | [Valve Protocol](#valve) |
| groundbreach | Ground Breach | [Valve Protocol](#valve) | | groundbreach | Ground Breach | [Valve Protocol](#valve) |
| gta5am | Grand Theft Auto V - alt:V Multiplayer | [Notes](#gta5am) | | 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) | | gta5r | Grand Theft Auto V - RageMP | [Notes](#gta5r) |
| gtasam | Grand Theft Auto: San Andreas Multiplayer | | | gtasam | Grand Theft Auto: San Andreas Multiplayer | |
| gtasamta | Grand Theft Auto: San Andreas - Multi Theft Auto | | | 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
### <a name="soldat"></a>Soldat ### <a name="soldat"></a>Soldat
Requires `Allow_Download` and `Logging` to be `1` in the server config. Requires `Allow_Download` and `Logging` to be `1` in the server config.
### <a name="gta5f"></a>Grand Theft Auto V - FiveM
Requires the `sv_exposePlayerIdentifiersInHttpEndpoint` convar to be `1` for the query to return players' data.

View file

@ -1303,7 +1303,8 @@ export const games = {
protocol: 'fivem' protocol: 'fivem'
}, },
extra: { extra: {
old_id: 'fivem' old_id: 'fivem',
doc_notes: 'gta5f'
} }
}, },
gta5r: { gta5r: {

View file

@ -20,7 +20,8 @@ export default class fivem extends quake2 {
if ('version' in state.raw.info) state.version = state.raw.info.version 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({ const json = await this.request({
url: 'http://' + this.options.address + ':' + this.options.port + '/players.json', url: 'http://' + this.options.address + ':' + this.options.port + '/players.json',
responseType: 'json' responseType: 'json'
@ -29,6 +30,6 @@ export default class fivem extends quake2 {
for (const player of json) { for (const player of json) {
state.players.push({ name: player.name, ping: player.ping }) state.players.push({ name: player.name, ping: player.ping })
} }
} } catch (_) {}
} }
} }