mirror of
https://github.com/tribufu/node-gamedig
synced 2026-06-01 09:42:41 +00:00
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:
parent
cf0144683d
commit
6bfc3426e7
5 changed files with 15 additions and 3 deletions
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue