Skip to content

Commit

Permalink
tweak(game/server): update bridge
Browse files Browse the repository at this point in the history
  • Loading branch information
itschip committed Jan 5, 2024
1 parent 0f8ac09 commit 2d4a5ac
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 30 deletions.
2 changes: 1 addition & 1 deletion apps/game/client/sounds/client-sound.class.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,4 @@ export class Sound {
ReleaseSoundId(this._soundId);
if (SoundIdsByName[this._soundName]) delete SoundIdsByName[this._soundName];
}
}
}
2 changes: 2 additions & 0 deletions apps/game/server/bridge/esx/esx-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class ESXFramework implements Strategy {
on("esx:playerLogout", async () => {
await PlayerService.handleUnloadPlayerEvent(global.source);
})

mainLogger.info('ESX bridge initialized');
}

onStart(): void {
Expand Down
2 changes: 2 additions & 0 deletions apps/game/server/bridge/qb/qbcore-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class QBCoreFramework implements Strategy {
on("QBCore:Server:OnPlayerUnload", async () => {
await PlayerService.handleUnloadPlayerEvent(global.source);
})

mainLogger.info('QBCore bridge initialized');
}

onStart(): void {
Expand Down
2 changes: 2 additions & 0 deletions apps/game/server/bridge/qbx/qbx-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ export class QBXFramework implements Strategy {
on('QBCore:Server:OnPlayerUnload', async () => {
await PlayerService.handleUnloadPlayerEvent(global.source);
});

mainLogger.info('QBX bridge initialized');
}

onStart(): void {
Expand Down
9 changes: 1 addition & 8 deletions apps/game/server/bridge/standalone/standalone-server.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,9 @@
import { config } from '@npwd/config/server';
import { mainLogger } from '../../sv_logger';
import { Strategy } from '../framework-strategy';

export class Standalone implements Strategy {
constructor() {
mainLogger.info('Loading Standalone bridge....');

config.general.useResourceIntegration = true;
config.database.identifierColumn = 'identifier';
config.database.phoneNumberColumn = 'phone_number';
config.database.playerTable = 'users';
config.database.identifierType = 'license';
mainLogger.info('Loading NPWD Standalone');
}

init(): void {
Expand Down
42 changes: 21 additions & 21 deletions examples/qbcore/ambulance_alert.lua
Original file line number Diff line number Diff line change
@@ -1,22 +1,22 @@
local QBCore = exports['qb-core']:GetCoreObject()
local QBCore = exports["qb-core"]:GetCoreObject()

RegisterNetEvent('hospital:server:ambulanceAlert', function(text)
local src = source
local ped = GetPlayerPed(src)
local coords = GetEntityCoords(ped)
local players = QBCore.Functions.GetQBPlayers()
for _, v in pairs(players) do
if v.PlayerData.job.name == 'ambulance' and v.PlayerData.job.onduty then
exports.npwd:emitMessage({
senderNumber = '911',
targetNumber = v.PlayerData.charinfo.phone,
message = 'Person is dead.',
embed = {
type = "location",
coords = { coords.x, coords.y, coords.z },
phoneNumber = '911'
}
})
end
end
end)
RegisterNetEvent("hospital:server:ambulanceAlert", function(text)
local src = source
local ped = GetPlayerPed(src)
local coords = GetEntityCoords(ped)
local players = QBCore.Functions.GetQBPlayers()
for _, v in pairs(players) do
if v.PlayerData.job.name == "ambulance" and v.PlayerData.job.onduty then
exports.npwd:emitMessage({
senderNumber = "911",
targetNumber = v.PlayerData.charinfo.phone,
message = "Person is dead.",
embed = {
type = "location",
coords = { coords.x, coords.y, coords.z },
phoneNumber = "911",
},
})
end
end
end)

0 comments on commit 2d4a5ac

Please sign in to comment.