Skip to content

Commit

Permalink
fix(gta5f): wrap query of players in a catch (#674)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
CosminPerRam authored Feb 9, 2025
1 parent c68db8f commit 467606f
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
5 changes: 4 additions & 1 deletion GAMES_LIST.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 | |
Expand Down Expand Up @@ -535,3 +535,6 @@ The query is done via the lightweight query option but also safely tries to util

### <a name="soldat"></a>Soldat
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.
3 changes: 2 additions & 1 deletion lib/games.js
Original file line number Diff line number Diff line change
Expand Up @@ -1303,7 +1303,8 @@ export const games = {
protocol: 'fivem'
},
extra: {
old_id: 'fivem'
old_id: 'fivem',
doc_notes: 'gta5f'
}
},
gta5r: {
Expand Down
5 changes: 3 additions & 2 deletions protocols/fivem.js
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand All @@ -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 (_) {}
}
}

0 comments on commit 467606f

Please sign in to comment.