[ESX & QB] tk_mdt - MDT System (Police & EMS)

i tried it but it not reading from database, i put it in server.lua and it has no error but when i buy new car in the mdt the new car shows only on my profile like without export and in vehicles page is no new car, i was tring to get there by clicking on car on my profile but it only opens new page named vechicles but with nothing, there osly black screen and thats all

i put it there like this

local function addVehicleToPlayer(source, vehicle, shopIndex, selectIndex, paymentMethod)

    local clientData = lib.callback.await('lsrp_vehicleshop:server:proceed', source, shopIndex)
    if not clientData.vehicleProperties or clientData.vehicleProperties.model ~= vehicle.VEHICLE_MODEL then return false end

    if plate.plateTaken(clientData.vehicleProperties.plate) then
        clientData.vehicleProperties.plate = plate.getPlate()
    end

    local playerIdentifier = framework.getPlayerIdentifier(source)
    if not playerIdentifier then return false end

    local success = db.addVehicle({
        identifier = playerIdentifier,
        plate = clientData.vehicleProperties.plate,
        properties = json.encode(clientData.vehicleProperties),
        hasFreeCoords = clientData.vehicleSpawnCoords and true,
        vehicleType = Config.VEHICLE_LIST[Config.vehicleShops[shopIndex].VEHICLE_LIST][selectIndex].dbData,
        vehicleName = vehicle.label
    })

    if not success then return false end

    -- Register the vehicle in MDT
    exports.tk_mdt:registerVehicle({
            playerId = playerIdentifier,                -- ID of the vehicle owner
            model = vehicle.VEHICLE_MODEL,              -- Vehicle model
            plate = clientData.vehicleProperties.plate  -- Vehicle plate
    })

    if type(clientData.vehicleSpawnCoords) == "vector3" or type(clientData.vehicleSpawnCoords) == "vector4" then
        spawnVehicle(vehicle.VEHICLE_MODEL, clientData.vehicleSpawnCoords, clientData.vehicleProperties, playerIdentifier)
    end

    hooks.onVehiclePurchase(vehicle.label, clientData.vehicleProperties.plate)
    dprint(('Purchase made! Player %s has purchased %s for %s'):format(source, vehicle.VEHICLE_MODEL, vehicle.VEHICLE_MODEL))
    functions.log({['Vehicle model'] = vehicle.label, ['Price'] = vehicle.VEHICLE_PRICE, ['Plate'] = clientData.vehicleProperties.plate, ['Buyer'] = GetPlayerName(source), ['Player identifier'] = playerIdentifier, ['Payment type'] = paymentMethod, ['Spawned around shop'] = clientData.vehicleSpawnCoords and true})

    return true, clientData.vehicleSpawnCoords and true, clientData.vehicleProperties.plate

end

Id needs to be the player server id, not identifier. So in your case just change it to source

okay it works, thank u so much for your support :heart:

1 Like

Update 1.4.1

  • More improvements to data handling

Update 1.4.2

  • Fix MDT title scaling
  • Add support for bcs housing

Does this work with qbox

Yes, should work fine

you don’t have the new qs-smartphone-pro in it yet, if not I’ve already put it in mine because it didn’t work with qs

So you can use it for both
main_editable.lua

if Config.Phone == ‘qs-smartphone-pro’ then
return exports[‘qs-smartphone-pro’]:GetPhoneNumberFromIdentifier(identifier, owner)
end

1 Like

Update 1.4.3

  • Fix licenses showing incorrectly on QB

Just droping suggestion, I often see the update on keymaster, but I rarely see you give a changelog or something. Please reduce updates like that like make too many minor update, postpone updates that aren’t so important and make them regular updates with changelogs. it makes us confused whether it is an important update or not.

If it’s an important update a changelog will be posted here, if not, then nothing will be posted

Hi, any chance for Fire Fighter MDT? Very good mdt we like police and ems!

I have gotten a few suggestions for allowing to add more MDTs (for example for DOJ or fire fighters). This is a feature that I would like to add but if it is ever released it will most likely be for a “2.0 update” of the MDT and at the moment I’m still unsure if it will ever be implemented.

3 Likes

Ok thank you. I will hunt for the one that can work best for adding with tk. best regards.

1 Like

sadness!

WE would love to add mdt’s to mechanics, dot, amongst other roleplay ideas

I’m planning to finish and release a few other scripts first but after those are done, I’ll most likely start working on the MDT 2.0 update since there’s actually been quite a bit of interest and requests for it

1 Like

can u create a case law tab?

we are running into the issue where the mdt is opening then it will stop working anyway to fix this?

I’m not quite sure what a “case law tab” is but most likely no. I recommend watching the video, it showcases all the features

Please open a ticket in our Discord