From dc633e7e8375507e94300a10bca2f378cf92e36f Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Sat, 30 Jul 2022 08:18:49 -0500 Subject: [PATCH] Use radio station index --- scripts/server/vehicle.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/scripts/server/vehicle.js b/scripts/server/vehicle.js index 0726cd88..3a5ecb4d 100644 --- a/scripts/server/vehicle.js +++ b/scripts/server/vehicle.js @@ -85,7 +85,8 @@ class VehicleData { this.trunkItemCache = []; this.dashItemCache = []; - this.streamingRadioStation = -1; + this.streamingRadioStation = 0; + this.streamingRadioStationIndex = -1; // Other/Misc this.insuranceAccount = 0; @@ -295,7 +296,7 @@ function saveVehicleToDatabase(vehicleDataId) { ["veh_int", toInteger(tempVehicleData.interior)], ["veh_vw", toInteger(tempVehicleData.dimension)], ["veh_livery", toInteger(tempVehicleData.livery)], - ["veh_radio_station", toInteger(getRadioStationData(tempVehicleData.radioStation).databaseId)], + ["veh_radio_station", toInteger(tempVehicleData.radioStation)], ]; let dbQuery = null; @@ -1776,6 +1777,10 @@ function resetVehiclePosition(vehicle) { function setAllVehicleIndexes() { for (let i in getServerData().vehicles) { getServerData().vehicles[i].index = i; + + if (getServerData().vehicles[i].streamingRadioStation != 0) { + getServerData().vehicles[i].streamingRadioStationIndex = getRadioStationIndexFromDatabase(getServerData().vehicles[i].streamingRadioStation); + } } }