fix: Added c query requests for gtasao (open.mp) (#547)

* Added full OMP support

* Added a new protocol for OMP which extends SAMP

* Edited the changelog
This commit is contained in:
Focus 2024-02-22 22:57:41 +02:00 committed by GitHub
parent cf0144683d
commit 6bfc3426e7
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 15 additions and 3 deletions

View file

@ -7,6 +7,7 @@ export default class samp extends Core {
this.magicHeader = 'SAMP'
this.responseMagicHeader = null
this.isVcmp = false
this.isOmp = false
}
async run (state) {
@ -40,13 +41,14 @@ export default class samp extends Core {
// read players
// don't even bother if > 100 players, because the server won't respond
if (state.numplayers < 100) {
if (this.isVcmp) {
if (this.isVcmp || this.isOmp) {
const reader = await this.sendPacket('c', true)
if (reader !== null) {
const playerCount = reader.uint(2)
for (let i = 0; i < playerCount; i++) {
const player = {}
player.name = reader.pascalString(1)
player.score = reader.int(4)
state.players.push(player)
}
}