Added full OMP support

This commit is contained in:
Ogrezeanu Alexandru 2024-02-22 13:56:21 +02:00
parent cf0144683d
commit 34597a98d6
3 changed files with 6 additions and 3 deletions

View File

@ -2446,7 +2446,7 @@ export const games = {
release_year: 2019,
options: {
port: 7777,
protocol: 'samp'
protocol: 'gtasao'
},
extra: {
old_id: 'saomp'

View File

@ -19,6 +19,7 @@ import gamespy2 from './gamespy2.js'
import gamespy3 from './gamespy3.js'
import geneshift from './geneshift.js'
import goldsrc from './goldsrc.js'
import gtasao from './gtasao.js'
import hexen2 from './hexen2.js'
import jc2mp from './jc2mp.js'
import kspdmp from './kspdmp.js'
@ -58,7 +59,7 @@ import theisleevrima from './theisleevrima.js'
export {
armagetron, ase, asa, assettocorsa, battlefield, buildandshoot, cs2d, discord, doom3, eco, epic, factorio, farmingsimulator, ffow,
fivem, gamespy1, gamespy2, gamespy3, geneshift, goldsrc, hexen2, jc2mp, kspdmp, mafia2mp, mafia2online, minecraft,
fivem, gamespy1, gamespy2, gamespy3, geneshift, goldsrc, gtasao, hexen2, jc2mp, kspdmp, mafia2mp, mafia2online, minecraft,
minecraftbedrock, minecraftvanilla, mumble, mumbleping, nadeo, openttd, palworld, quake1, quake2, quake3, rfactor, samp,
savage2, starmade, starsiege, teamspeak2, teamspeak3, terraria, tribes1, tribes1master, unreal2, ut3, valve,
vcmp, ventrilo, warsow, eldewrito, beammpmaster, beammp, dayz, theisleevrima

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)
}
}