Project-Sloth / ps-mdt

MDT for QBCore
https://discord.gg/projectsloth
GNU General Public License v3.0
245 stars 282 forks source link

Issues with adding a department #92

Closed TankinTom closed 2 years ago

TankinTom commented 2 years ago

Per Monkey in the discord, I'm adding this as a bug. I was able to add another department, they pull up in the MDT, but show up as LSPD. I went into the app.js and tried to add a line for them to be called Sheriff, restarted the MDT, now everyone shows as sheriff. I already added the job in the const Policejobs section. By default, only LSPD shows up. I read the FAQ, and wanted to add the sheriffs department, got everything setup with alerts(dispatch) but can't find a way for them to show up as "sheriff" in the MDT, they show as LSPD. Monkey told me to have the code like this: if (PoliceJobs[unit.unitType] !== undefined) { policeCount++; activeInfoJob = <div class="unit-job active-info-job-lspd">LSPD</div>; activeInfoJob = <div class="unit-job active-info-job-bcso">BCSO</div>; The issue with that, is because sheriff/BCSO is being called last, everyone shows up as that. I'm sure it's probably something easy to fix in the code, and I made it this far.

jnccloud commented 2 years ago

Per Monkey in the discord, I'm adding this as a bug. I was able to add another department, they pull up in the MDT, but show up as LSPD. I went into the app.js and tried to add a line for them to be called Sheriff, restarted the MDT, now everyone shows as sheriff. I already added the job in the const Policejobs section. By default, only LSPD shows up. I read the FAQ, and wanted to add the sheriffs department, got everything setup with alerts(dispatch) but can't find a way for them to show up as "sheriff" in the MDT, they show as LSPD. Monkey told me to have the code like this: if (PoliceJobs[unit.unitType] !== undefined) { policeCount++; activeInfoJob = <div class="unit-job active-info-job-lspd">LSPD</div>; activeInfoJob = <div class="unit-job active-info-job-bcso">BCSO</div>; The issue with that, is because sheriff/BCSO is being called last, everyone shows up as that. I'm sure it's probably something easy to fix in the code, and I made it this far.

Try this for the ifelse block:

if (PoliceJobs[unit.unitType] !== undefined) {
          policeCount++;
          if (unit.unitType == "police") {
            activeInfoJob = `<div class="unit-job active-info-job-lspd">LSPD</div>`;
          } else if(unit.unitType == "bcso")  {
            activeInfoJob = `<div class="unit-job active-info-job-bcso">BCSO</div>`;
          } else if(unit.unitType == "judge")  {
            activeInfoJob = `<div class="unit-job active-info-job-doj">DOJ</div>`;
          }
        } else if (AmbulanceJobs[unit.unitType] !== undefined) {
          activeInfoJob = `<div class="unit-job active-info-job-ambulance">Ambulance</div>`
          emsCount++;
        /* } else if  (DojJobs[unit.unitType] !== undefined) {
          activeInfoJob = `<div class="unit-job active-info-job-fire">FIRE</div>`
          fireCount++; */
        } else if (DojJobs[unit.unitType] !== undefined) {
          activeInfoJob = `<div class="unit-job active-info-job-doj">DOJ</div>`
          dojCount++;
        }

I use mine like this and have no problems with it so far.

MonkeyWhisper commented 2 years ago

Per Monkey in the discord, I'm adding this as a bug. I was able to add another department, they pull up in the MDT, but show up as LSPD. I went into the app.js and tried to add a line for them to be called Sheriff, restarted the MDT, now everyone shows as sheriff. I already added the job in the const Policejobs section. By default, only LSPD shows up. I read the FAQ, and wanted to add the sheriffs department, got everything setup with alerts(dispatch) but can't find a way for them to show up as "sheriff" in the MDT, they show as LSPD. Monkey told me to have the code like this: if (PoliceJobs[unit.unitType] !== undefined) { policeCount++; activeInfoJob = <div class="unit-job active-info-job-lspd">LSPD</div>; activeInfoJob = <div class="unit-job active-info-job-bcso">BCSO</div>; The issue with that, is because sheriff/BCSO is being called last, everyone shows up as that. I'm sure it's probably something easy to fix in the code, and I made it this far.

Can you check the reply above?

Let us know if this works

TankinTom commented 2 years ago

We ended up going with Sonoran for a MDT/CAD, but if we switch back, I'll use what @jnccloud suggested!