Skip to content

MaDHouSe79/mh-drivingteacherjob

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Hi 👋, I'm MaDHouSe

A passionate allround developer

MH Driving Teacher Job for QBCore.

  • There are 15 licences you can give to players with this job.

Read UPDATE.MD

  • if there is a update read the update.md, maby you need to change something.

How it works:

  • To bill a player for a licence use /bill [id] [amount]
  • you can also add some objects on the road as drive test obstacles, so the student can show his/her driving skills ;)
  • when spawning a vehicle, you must go insite this vehicle drivers seat and use /givekeys [id]
  • with this you give the vehicle keys to the student so he/she can use the vehicle.
  • When you give the keys, you get into the co-driver's seat and take the exam.
  • When a student passes the exam, use /give-licence [id] [N/A/AM/B/BE/C/CE/D/DE/P/T/H] Ex: /give-licence 1 BE
  • The fist licence you must always give the licence N this is the theory.
  • The N licence this is only when a player does not have the N licence so you know you this player is a starter)
  • To take a the licence from a player use /take-licence [id] (this player is no longer licensed) Ex: /take-licence 1
  • The police can use this commands /give-licence 1 N and /take-licence 1

NOTE !!:

  • Edit qb-smallresources/config.lua and remove or set true to false for vehicles you don't want to be blacklisted
  • if you don't do this, the vehicle will spawn, but will also removeed after spawning, or it does not spawn at all.
  • So don't forget this part if you use the airplane or helikopter license.
  • To use one of this vehicles in that list, than just set it to false restart the server, and your done.

Dependencies:

Installation:

  • Create a folder [mh] in resources.
  • Put mh-drivingteacherjob in to resources/[mh].
  • Load this script after target and polyzone.
  • in sever.sfg after [standalone] add -> ensure [mh]
  • After you done with the instructions below, you can restart the server.

Read The README.md!!!

foto1

Edit qb-core\server\player.lua around line 120 to this code:

PlayerData.metadata['licences'] = PlayerData.metadata['licences'] or {
    ['N'] = false, -- theory
    ['AM'] = false, -- scooter
    ['A'] = false, -- motorcycle
    ['B'] = false, -- car
    ['BE'] = false, -- car
    ['C'] = false, -- truck
    ['CE'] = false, -- truck + trailer
    ['D'] = false, -- bus
    ['DE'] = false, -- bus + trailer
    ['P'] = false, -- plane or heli pilot
    ['T'] = false, -- boat
    ['H'] = false, -- Helikopter
    ['R'] = false, -- race
    ['AMB'] = false, -- Ambulance
    ['POL'] = false, -- Police
    ['business'] = false,
    ['weapon'] = false
}

Edit qb-core\shared\main.lua:

  • why? cause if people join the server and create a new character,
  • they get a driver_license, and we don't want that.
QBShared.StarterItems = {
    ['phone'] = { amount = 1, item = 'phone' },
    ['id_card'] = { amount = 1, item = 'id_card' },
    --['driver_license'] = { amount = 1, item = 'driver_license' },
}

Add to resources/[qb]/qb-management/client/cl_config.lua to Config.BossMenus:

  • This is the bossmenu location
['drivingteacher'] = {
    vector3(215.24, -1401.76, 30.58) --  (Bossmenu)
},

Add to resources/[qb]/qb-management/client/cl_config.lua to Config.BossMenuZones:

  • This is the bossmenu zone
['drivingteacher'] = {
    { coords = vector3(215.24, -1401.76, 30.58), length = 1.15, width = 2.6, heading = 307.07, minZ = 43.59, maxZ = 44.99 },
},

Add To qb-core/qb-shared/jobs.lua:

['drivingteacher'] = {
    name  = 'drivingteacher',
	label = 'Driving school',
        type  = 'driveschool',
	defaultDuty = false,
	offDutyPay = false,
	grades = {
        ['0'] = {
            name = 'Teorie instructeur',
            payment = 250
        },
        ['1'] = {
            name = 'Drive instructeur',
            payment = 255
        },
        ['2'] = {
            name = 'Fly instructeur',
            payment = 500
        },
        ['3'] = {
            name = 'Examen instructeur',
            payment = 500
        },
        ['4'] = {
            name = 'Boss',
            isboss = true,
            payment = 1000
        },
    },
},

Add to resources/[qb]/qb-radialmenu/config.lua inside the Config.JobInteractions:

["drivingteacher"] = {
    {
        id = 'playerlicinceoptions2',
        title = 'Licince Options',
        icon = 'plus',
        items = {
            {
                id = 'givelicince1',
                title = 'Give',
                icon = 'plus',
                type = 'client',
                event = 'mh-drivingteacherjob:client:giveLicinceMenu',
                shouldClose = true
            },
        }
    },
    {
        id = 'instructorobjects',
        title = 'Objects',
        icon = 'road',
        items = {
            {
                id = 'deleteobject1',
                title = 'Remove Object',
                icon = 'trash',
                type = 'client',
                event = 'police:client:deleteObject',
                shouldClose = false
            }, {
                id = 'spawnhek1',
                title = 'Gate',
                icon = 'torii-gate',
                type = 'client',
                event = 'police:client:spawnBarrier',
                shouldClose = false
            }, {
                id = 'spawnpion1',
                title = 'Cone',
                icon = 'triangle-exclamation',
                type = 'client',
                event = 'police:client:spawnCone',
                shouldClose = false
            }, {
                id = 'spawntent1',
                title = 'Tent',
                icon = 'campground',
                type = 'client',
                event = 'police:client:spawnTent',
                shouldClose = false
            }, {
                id = 'spawnverlichting1',
                title = 'lighting',
                icon = 'lightbulb',
                type = 'client',
                event = 'police:client:spawnLight',
                shouldClose = false
            },
        }
    },
},

Edit qb-phone Option 1 resources/[qb]/qb-phone/server.lua around line 1055

  • Change the Command bill with this code below
QBCore.Commands.Add('bill', 'Bill A Player', {{name = 'id', help = 'Player ID'}, {name = 'amount', help = 'Fine Amount'}}, false, function(source, args)
    local biller = QBCore.Functions.GetPlayer(source)
    local billed = QBCore.Functions.GetPlayer(tonumber(args[1]))
    local amount = tonumber(args[2])
    if biller.PlayerData.job.name == "police" or biller.PlayerData.job.name == 'ambulance' or biller.PlayerData.job.name == 'mechanic' or biller.PlayerData.job.name == 'drivingteacher' then
        if billed ~= nil then
            if biller.PlayerData.citizenid ~= billed.PlayerData.citizenid then
                if amount and amount > 0 then
                    MySQL.insert('INSERT INTO phone_invoices (citizenid, amount, society, sender, sendercitizenid) VALUES (?, ?, ?, ?, ?)', {billed.PlayerData.citizenid, amount, biller.PlayerData.job.name, biller.PlayerData.charinfo.firstname, biller.PlayerData.citizenid})
                    TriggerClientEvent('qb-phone:RefreshPhone', billed.PlayerData.source)
                    TriggerClientEvent('QBCore:Notify', source, 'Invoice Successfully Sent', 'success')
                    TriggerClientEvent('QBCore:Notify', billed.PlayerData.source, 'New Invoice Received')
                else
                    TriggerClientEvent('QBCore:Notify', source, 'Must Be A Valid Amount Above 0', 'error')
                end
            else
                TriggerClientEvent('QBCore:Notify', source, 'You Cannot Bill Yourself', 'error')
            end
        else
            TriggerClientEvent('QBCore:Notify', source, 'Player Not Online', 'error')
        end
    else
        TriggerClientEvent('QBCore:Notify', source, 'No Access', 'error')
    end
end)

Edit qb-phone Option 2 resources/[qb]/qb-phone/server.lua around line 1055

  • You can add or biller.PlayerData.job.name == 'drivingteacher'
  • to the job check if statement and add this to the end before then
  • example:
if biller.PlayerData.job.name == "police" or biller.PlayerData.job.name == 'ambulance' or biller.PlayerData.job.name == 'mechanic' or biller.PlayerData.job.name == 'drivingteacher' then

Edit qb-phone/html/js/lawyers.js

  • to call a driving teacher (if this player is online)
  • you can change the colers in rgb()

Add to qb-phone/html/js/lawyers.js around line 9/10

var drivingteacher = [];

Add to qb-phone/html/js/lawyers.js around line 36

if (lawyer.typejob == "drivingteacher") {
    drivingteacher.push(lawyer);
}

Add to qb-phone/html/js/lawyers.js around line 134

$(".lawyers-list").append('<br><h1 style="font-size:1.641025641025641vh; padding:1.0256410256410255vh; color:#fff; margin-top:0; width:100%; display:block; background-color: rgb(155, 15, 120);">Driving Teacher (' + drivingteacher.length + ')</h1>');
if (drivingteacher.length > 0) {
    $.each(drivingteacher, function(i, lawyer10) {
        var element = '<div class="lawyer-list" id="lawyerid10-' + i + '"> <div class="lawyer-list-firstletter" style="background-color: #0d1218c0;">' + (lawyer10.name).charAt(0).toUpperCase() + '</div> <div class="lawyer-list-fullname">' + lawyer10.name + '</div> <div class="lawyer-list-call"><i class="fas fa-phone"></i></div> </div>'
        $(".lawyers-list").append(element);
        $("#lawyerid1-" + i).data('LawyerData', lawyer10);
    });
} else {
    var element = '<div class="lawyer-list"><div class="no-lawyers">There are no driving teachers online.</div></div>'
    $(".lawyers-list").append(element);
}

My Youtube Channel and Discord

Add to qb-phone/html/js/lawyers.js around line 176

$(".lawyers-list").append('<br><h1 style="font-size:1.641025641025641vh; padding:1.0256410256410255vh; color:#fff; margin-top:0; width:100%; display:block; background-color: rgb(155, 15, 120);">Driving Teacher (' + drivingteacher.length + ')</h1>');
var element = '<div class="lawyer-list"><div class="no-lawyers">There are no driving teachers.</div></div>'
$(".lawyers-list").append(element);

© MaDHouSe79

About

QBCore Driving Teacher Job By MaDHouSe79

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages