diff --git a/README.MD b/README.MD index 2721432..fe4736e 100644 --- a/README.MD +++ b/README.MD @@ -1,6 +1,6 @@ ## This is a simple Multijob script I made cause too many people were charging $15+ for something so simple.  - +Credit: https://github.com/Kmack710/710-multiJob ## Add this to your Database! Without this it wont work! Be sure to change payment amount below to the amount of your unemployeed Paycheque ```sql ALTER TABLE `players` @@ -10,3 +10,10 @@ ALTER TABLE `players` ## Dependancies - QBCore - Qb-menu or Renzucontextmenu + +## Flek's Updates: +### v1.0.1: +- Added a callback to grab the label of job_two allowing you to put that on the menu +- Added support for old qbcore +## + diff --git a/config.lua b/config.lua index 0fc599a..0c06e52 100644 --- a/config.lua +++ b/config.lua @@ -1,7 +1,11 @@ Config = {} -- ONLY HAVE ONE OF THESE SET TO TRUE! Config.usingQBmenu = false -- If you want to use the QB Menu, set this to true. -Config.usingRenzuContext = true --- If you want to use the Renzu Context Menu, set this to true. https://github.com/renzuzu/renzu_contextmenu +Config.usingRenzuContext = false --- If you want to use the Renzu Context Menu, set this to true. https://github.com/renzuzu/renzu_contextmenu -- ^^^^^^ ONLY HAVE ONE OF THESE SET TO TRUE! -Config.OpenKey = 'NUMPAD9' -- The key to open the menu. \ No newline at end of file +Config.Core = 'new' -- what qbcore are you using | options allowed: 'old', 'new' +Cofnig.Open = 'command' -- how do you want to open the multijob menu | options allowed: 'command', 'key' +Config.OpenKey = 'NUMPAD9' -- The key to open the menu. - only used if Cofnig.Open is set to key +Config.Command = 'multijob' -- The command to open the menu. - only used if Cofnig.Open is set to command +Config.MenuHeader = 'Multi Job' -- Header for menu (qb-menu only for this version) \ No newline at end of file diff --git a/data/client.lua b/data/client.lua index 3bd8d75..fdacd49 100644 --- a/data/client.lua +++ b/data/client.lua @@ -1,22 +1,58 @@ -local QBCore = exports['qb-core']:GetCoreObject() +-- Variables -RegisterKeyMapping('+changejob', 'Toggle MultiJob Menu', 'keyboard', Config.OpenKey) +local QBCore = nil +local job2label = "Unknown" + +-- Grab core object + +if Config.Core == 'new' then --new core + QBCore = exports['qb-core']:GetCoreObject() +else --old core + Citizen.CreateThread(function() + while QBCore == nil do + TriggerEvent("QBCore:GetObject", function(obj) QBCore = obj end) + Citizen.Wait(10) + end + end) +end + +-- Register keybind or command + +if Cofnig.Open == "key" then + RegisterKeyMapping('+changejob', 'Toggle MultiJob Menu', 'keyboard', Config.OpenKey) + + RegisterCommand('+changejob', function() + TriggerEvent('710-multiJob:Client:OpenMenu') + end) +else + RegisterCommand(Config.Command, function() + TriggerEvent('710-multiJob:Client:OpenMenu') + end) +end + +-- Events -RegisterCommand('+changejob', function() - TriggerEvent('710-multiJob:Client:OpenMenu') -end) if Config.usingQBmenu then RegisterNetEvent('710-multiJob:Client:OpenMenu', function() + QBCore.Functions.TriggerCallback('710-multiJob:Server:checkjob2', function(results) + if not results then + TriggerEvent("QBCore:Notify", "Error Fetching Job ", "error") + job2label = "Unknown" + else + job2label = results + end + end) + Wait(1000) local Player = QBCore.Functions.GetPlayerData() local citizenid = Player.citizenid local Menu = { { - header = "

Change Jobs