Project Sloth MDT - How to add Licenses - ps-mdt

Project Sloth MDT - How to Add a License - ps-mdt

Hi everyone. This is going to be my first release. This tutorial is how to add your own custom License to PS-MDT ([Project Sloth] [FREE] QBCore Dispatch & MDT)

I have been trying to figure out how to add a License to the MDT for a while now. I finally took a different approach and figured it out. I hope this is the right way to do it. There is no data that I have been able to locate within discord searches or online searches that explains the process. This is my method only that I just completed and tested quite a few times to make sure it all worked, and it does.

Edit using Visual Studio Code.

For this example I will be adding Drifting license to the MDT

Step 1
Open \ps-mdt\ui\app.js
Search for:

var licenseTypes

You should get 2 results.

      var licenseTypes = ['business', 'pilot', 'weapon', 'driver',];

add drifting to this line

      var licenseTypes = ['business', 'pilot', 'weapon', 'driver', 'drifting'];


should look like this when done.

Search for:

$(".licenses-holder").on("contextmenu", ".license-tag", function (e) {

You should see the following:
Notice I added Drifting in there

    } else if (type == "Drifting") {
      info = "drifting";

Step 2
Open \ps-mdt\server\dbm.lua
Search for:

function GetPlayerLicenses(identifier)

Notices the red lines I placed. You are going to add a line

['drifting'] = false

Search for:

function ManageLicenses(identifier, incomingLicenses)

Notices the red lines I placed. You are going to add a line

['drifting'] = false

Step 3
Open \qb-core\server\player.lua
Search for:

PlayerData.metadata['licences'] = PlayerData.metadata['licences'] or {

Notices the red lines I placed. You are going to add a line

['drifting'] = false

After these edits are done. You need to go into your SQL DB area. We will be editing the players/metadata table.
I am using HeidiSQL. If you have another software to access your sql database, the steps should still be the same.
Go to your Players Table
Press Data on the top so you can view the information stored within that table
In here you are going to see all of your players data on the server.
Scroll to the right so you can see the metadata column. Information that is stored here is pulled by a lot of different scripts and tools, one of them being the ps-mdt licensing information. If you look at one of your players metadata information you will see the text we are going to be looking for. I copy and paste this data into a empty tab on Visual Studio Code so it is easier to view:

{"status":[],"heistrep":0,"commandbinds":[],"callsign":"NO CALLSIGN","weaponrep":95,"bloodtype":"AB+","walletid":"QB-70914535","cardeliveryxp":0,"stress":0,"attachmentcraftingrep":0,"hunger":78.99999999999999,"meleerep":0,"fitbit":[],"ishandcuffed":false,"inside":{"apartment":[]},"health":200,"fingerprint":"az594N16ehE6391","jailitems":[],"isdead":false,"thirst":81.00000000000002,"phone":[],"toolrep":0,"textilerep":0,"tracker":false,"streetrep":0,"phonedata":{"InstalledApps":[],"SerialNumber":84281577},"mechanicrep":0,"licences":{"drifting":false,"driver":true,"business":false,"weapon":false},"criminalrecord":{"hasRecord":false},"jobrep":{"tow":0,"trucker":0,"hotdog":0,"taxi":0},"craftingrep":0,"dealerrep":0,"bladerep":0,"lumberyardrep":0,"armor":0,"prisonrep":0,"electronicrep":0,"inlaststand":false,"injail":0}

here is the code i am copying over to view

Inside this code you will see


And after the { you will see the license types that the sql db is storing. I think default should just be driver, business, weapon. And they should either be set to false or true.
Now it is time to add the drifting license code to this area. This is what I did:
Back inside HeidiSQL, make sure you have the players table selected on your left panel
Now on your right panel where you are viewing the Data, I did a find command


I took the code that I pasted into Visual Studio Code and put that in the Text to find field


then I checked Replace and converted it into:


I then press Replace All. Done. If you have a lot of tables, this will take a while. Do not stop it or close it out, let it finish.

Restart your server and you should now see Drifting in your MDT area for player licenses.

Give and Revoke license works and saves correctly. No issues that I see.

I know the method I have here works. The problem is what I am drawing a blank on is the SQL DB edit. I can’t remember at all the query that would be executed to add the


line to the metadata area. Instead of doing the find and replace all like I am explaining above, there should be a way for a query to be ran to add it to the license area correctly. I just can’t remember how to do it or if its even a option.

And I do not know if there is a way to have the drifting license info added to the metadata on current players other than how i explained it.

Other than that, this is my “How To” on adding a license to PS-MDT. If someone that reads this and comments in on what the query is to run on the sql db is I will adjust this Tutorial and add it here.

Newly created characters will automatically have the drifting license set to false. We added that instruction in with the edits we did inside \qb-core\server\player.lua file

Thank you, and good luck.



your welcome

thinking about making adjustments to the instructions.