Project Sloth MDT - How to Add a License - ps-mdt
Hello this is my first post here. I just wanted to provide an update to a forum that’s since been closed on how to add a new type of license to the ps-mdt because it took me a while to figure it out since one spot of the code in ps-mdt was streamlined and is changed. original topic from BigSmash (Project Sloth MDT - How to Add a License - ps-mdt )
The main thing that’s different is step one where you are replacing the line that he says looks like this
var licenseTypes = ['business', 'pilot', 'weapon', 'driver',];
now looks like this
var licenseTypes = licenseTypesGlobal;
both of these lines you do not change.
Everything after you do the same.
then when you get to the part of changing the database I highly recommend making a back up. I use HeidiSQL. The backup process is as follows
1st: Right click your database and select export as SQL
2nd: make sure both boxes are check beside create, data: is set to insert and then set a path where you want it save and set the filename.
Hit export and let it run.
You can change the database like he does, but make sure the server is off or no one is online or their players data will not update because the database saves what’s happening in city over what you change if people are still playing. His way of updating the player metadata worked fine for me, I’m not sure what the SQL query is either nor do I want to give you something that may be wrong.
Adding the physical item to give players
Now to add the physical item players can retrieve from City Hall like your weapon license (qb-core).
1st:
You need to create an item to give the players. Here’s the one I’m making while doing this (make sure you make an image to go with it. (or use this website to find free ones)
huntinglicense = { name = 'huntinglicense', label = 'Hunting License', weight = 0, type = 'item', image = 'hunting_license.png', unique = true, useable = true, shouldClose = true, combinable = nil, description = 'You need this to hunt legally' },
2nd:
drop your picture into your inventory scripts html/images folder
3rd:
Add your item to the city hall menu. Go into qb-cityhall/config:line:15ish and add your item to the menu like I’ve done here:
Config.Cityhalls = {
{ -- Cityhall 1
coords = vec3(-265.0, -963.6, 31.2),
showBlip = true,
blipData = {
sprite = 487,
display = 4,
scale = 0.65,
colour = 0,
title = 'City Services'
},
licenses = {
['id_card'] = {
label = 'ID Card',
cost = 50,
},
['driver_license'] = {
label = 'Driver License',
cost = 50,
metadata = 'driver'
},
['weaponlicense'] = {
label = 'Weapon License',
cost = 1000,
metadata = 'weapon'
},
['huntinglicense'] = {
label = 'Hunting License',
cost = 100,
metadata = 'hunting'
},
}
},
}
4th: Go into qb-cityhall/locales/(whichever language you use, I’m using en), and add your line for you item like this:
5th:
Next go into server/main.lua and add your event here, I just copied weapon license and pasted it below like this:
6th:
Lastly go into your inventory script/app.js and find else if (itemData.name == "weaponlicense"
. Copy that whole section and paste it underneath and change "weaponlicense"
to "huntinglicense"
like this:
(I use ps-inventory so if you dont it may be different)
Just save and restart and you should be good to go! I’m no genius when it comes to lua, but I know enough to be dangerous. I’ll provide as much help as I can if anyone has questions!