From d10c6f419f9745739610fe302b23b53bc0ea0776 Mon Sep 17 00:00:00 2001 From: Vortrex <3858226+VortrexFTW@users.noreply.github.com> Date: Mon, 28 Dec 2020 01:26:27 -0600 Subject: [PATCH] Fix job labels --- scripts/server/job.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/scripts/server/job.js b/scripts/server/job.js index 0fed285b..d038ef3b 100644 --- a/scripts/server/job.js +++ b/scripts/server/job.js @@ -986,6 +986,9 @@ function isPlayerInJobVehicle(client) { // --------------------------------------------------------------------------- function isPlayerWorking(client) { + if(!getClientCurrentSubAccount(client)) { + return false; + } return getClientCurrentSubAccount(client).isWorking; } @@ -1102,12 +1105,12 @@ function stopReturnToJobVehicleCountdown(client) { function sendAllJobLabelsToPlayer(client) { let tempJobLocations = []; for(let k in getServerData().jobs) { - for(m in getServerData().jobs[i].locations) { + for(let m in getServerData().jobs[k].locations) { tempJobLocations.push({ - id: getServerData().jobs[i].locations[j].databaseId, - jobType: getServerData().jobs[i].jobType, - name: getServerData().jobs[i].name, - position: getServerData().jobs[i].locations[j].position, + id: getServerData().jobs[k].locations[m].databaseId, + jobType: getServerData().jobs[k].jobType, + name: getServerData().jobs[k].name, + position: getServerData().jobs[k].locations[m].position, }); } } @@ -1119,10 +1122,10 @@ function sendAllJobLabelsToPlayer(client) { for(let i = 0 ; i < totalNetworkEvents ; i++) { for(let j = 0 ; j < jobLocationsPerNetworkEvent ; j++) { let tempJobLocationId = (i*jobLocationsPerNetworkEvent)+j; - if(typeof getServerData().jobs[k] != "undefined") { + //if(typeof getServerData().jobs[i] != "undefined") { let tempJobLabels = []; tempJobLabels.push([tempJobLocations[i].id, tempJobLocations[i].position, getGameConfig().propertyLabelHeight[getServerGame()], tempJobLocations[i].name, tempJobLocations[i].jobType, false]); - } + //} } triggerNetworkEvent("ag.joblabel.all", client, tempJobLabels); tempJobLabels = [];