![[Release] [QBCore/Qbox] [Paid] Manage Multiple Jobs! (momof-multijob) main image](https://forum-cfx-re.akamaized.net/optimized/4X/2/0/6/20612e1425fa489e63cbaa33475601c0acd0c165_2_690x138.png)
![[Release] [QBCore/Qbox] [Paid] Manage Multiple Jobs! (momof-multijob) thumbnail 1](https://forum-cfx-re.akamaized.net/optimized/4X/2/0/6/20612e1425fa489e63cbaa33475601c0acd0c165_2_690x138.png)
![[Release] [QBCore/Qbox] [Paid] Manage Multiple Jobs! (momof-multijob) thumbnail 2](https://forum-cfx-re.akamaized.net/original/4X/6/2/2/622c789e538d737f2ef35884758c518417121369.png)
Price
UnknownA script by momof513
Price
UnknownEver had players who wanted to have multiple jobs and struggled to manage it? Now there is a clean interface you can introduce to your players to switch between their jobs, on duty vs off duty, and leave jobs too! This can all be configured to your liking! You can use QB-Target, use it as a command, or even bind it to a specific key. You can customize the command name or bound key! This is sold via escrow but you can buy various levels of source code. It has a ton of exports which are all documented, and I provide awesome service so you shouldn’t have a need to pay for the full source! Can be used for modifying any scripts you want! View the documentation and config below!
Installation: Drag + Drop and edit the config.lua! No database or anything else needed! If you are using qb-management, there is a small change to ensure you always get the list of all the users with the job!
In qb-management/server/sv_boss.lua you should just change the MySQL query in the qb-bossmenu:server:GetEmployees callback from:
local players = MySQL.query.await("SELECT * FROM `players` WHERE `job` LIKE '%".. jobname .."%'", {})
to:
local players = MySQL.query.await("SELECT * FROM players WHERE job LIKE '%".. jobname .."%' OR metadata LIKE '%\"".. jobname .."\":%'", {})
Momof-Multijob Documentation
For easier access and ability for other developers to build on this, I have created a guide and exported events that are not used in the script for easier access building on top of the script.
Events
Client Events (Client or Server originations)
momof-multijob:client:OpenJobMenu
Opens the multi job menu for the client
Example Server Call:
TriggerClientEvent('momof-multijob:client:OpenJobMenu', src)
Example Client Call:
TriggerEvent('momof-multijob:client:OpenJobMenu')
Server Events (Originating from client)
momof-multijob:server:SetDuty
Parameters: New value for on duty (true/false)
Sets the players on duty.
Example Call:
TriggerServerEvent('momof-multijob:server:SetDuty', true)
momof-multijob:server:SwitchJob
Parameters: Job name(string), Job grade(number or string)
Switches the player to another job and grade (only works if they already have the job).
Example Call:
TriggerServerEvent('momof-multijob:server:SwitchJob', 'police', 2)
momof-multijob:server:QuitJob
Parameters: Job name(string)
Removes the given job from the player. If they do not have the job, it does nothing. If it is their currently active job, it will set their job to unemployed.
Example Call:
TriggerServerEvent('momof-multijob:server:QuitJob', 'police')
Server Callbacks (Originating from client)
GetPlayerJobs
Parameters: Source
Gets a list of Job objects (same as they would look if they were an active job) that the player has.
Example Call:
QBCore.Functions.TriggerCallback('momof-multijob:server:GetPlayerJobs', function(jobs) ... end)
GetPlayerJobsTable
Parameters: Source
Gets a list of the jobs the player has in a format of:
{ "job_name": job_grade, "job_name_2": job_grade_2 }
. Helpful for quick lookups.Example Call:
QBCore.Functions.TriggerCallback('momof-multijob:server:GetPlayerJobsTable', function(jobsTable) ... end)
Exports
Client Exports
GetJobs
Gets a list of Job objects (same as they would look if they were an active job) that the player has.
Example Call:
exports['momof-multijob']:GetJobs()
OpenJobMenu
Quits the job for the player, if they have the job.
Example Call:
exports['momof-multijob']:OpenJobMenu()
HasJob
Parameters: Job name(string)
Returns true if the player has the job, returns false otherwise.
Example Call:
exports['momof-multijob']:HasJob('police')
HasJobWithGrade
Parameters: Job name(string), Job grade(number or string)
Returns true if the player has the job and at that current grade, returns false otherwise.
Example Call:
exports['momof-multijob']:HasJobWithGrade('police', 2)
Server Exports
AddPlayerJob
Parameters: Source, Job name(string), Job grade(number or string)
Adds a job to the player list (without switching to the job). This could also be used for promoting/demoting, it will override the existing grade. If you want to switch to the job, it’s advisable to use
Player.Functions.SetJob
instead and it will also be automatically added to the multijobs as well.Example Call:
exports['momof-multijob']:AddPlayerJob(src, 'police', 4)
GetPlayerJobs
Parameters: Source
Gets a list of Job objects (same as they would look if they were an active job) that the player has.
Example Call:
exports['momof-multijob']:GetPlayerJobs(src)
GetPlayerJobsTable
Parameters: Source
Gets a list of the jobs the player has in a format of:
{ "job_name": job_grade, "job_name_2": job_grade_2 }
. Helpful for quick lookups.Example Call:
exports['momof-multijob']:GetPlayerJobsTable(src)
HasJob
Parameters: Source, Job name(string)
Returns true if the player has the job, returns false otherwise.
Example Call:
exports['momof-multijob']:HasJob(src, 'police')
HasJobWithGrade
Parameters: Source, Job name(string), Job grade(number or string)
Returns true if the player has the job and at that current grade, returns false otherwise.
Example Call:
exports['momof-multijob']:HasJobWithGrade(src, 'police', 2)
RemovePlayerJob
Parameters: Source, Job name(string)
Removes the given job from the player. If they do not have the job, it does nothing. If it is their currently active job, it will set their job to unemployed.
Example Call:
exports['momof-multijob']:RemovePlayerJob(src, 'police')
Config = Config or {}
-- Supported values: "QBCore", "Qbox"
Config.Core = "QBCore"
-- Emote that is used when the player opens the job menu.
Config.Emote = 'tablet'
-- Name of the job if the player has no job (Most likely do not need to change).
-- Needed to exclude job from list and to set their job to this when they quit an active job.
Config.UnemployedJobName = 'unemployed'
-- If you want a command to be able to open the job menu. If so you get to choose the command too.
-- Default: /jobmenu
Config.UseCommand = true
Config.CommandName = 'jobmenu'
-- If you want to use a have key to open the menu enable 'UseKeyMapping' and put the key code for 'Key'.
Config.UseKeyMapping = false
Config.Key = 'F4'
-- This is to disable the option to toggle on and off duty in the UI.
Config.DisableOnDuty = false
-- This is if you want to call 'QBCore:Notify' to be called when the user does successfully quit/switch jobs or toggle duty.
Config.NotifyPlayerOnChanges = true
-- Variables:
-- {JobName} - The name of the job they just went on duty to, switched to, or quit.
-- This can be used for all strings except noJobsFound and headerTitle.
Config.LocaleStrings = {
['headerTitle'] = 'Job Selection',
['noJobsFound'] = 'No jobs found.',
['quitConfirm'] = 'Are you sure you want to quit your job at {JobName}?',
['onduty'] = 'You are now on duty',
['offduty'] = 'You are now off duty',
['jobSwitchOnDuty'] = 'You are now on duty at {JobName}',
['jobSwitchOffDuty'] = 'You are now off duty at {JobName}',
['quitJob'] = 'You no longer work at {JobName}',
}
Screenshot:
Features:
Dependencies:
Uses escrow but can also buy react project or full open source
Showcase Video: Video
Escrow: Tebex $20
Escrow + React: Tebex $40
Full Source: Tebex $80
Code is accessible | No |
Subscription-based | No |
Lines (approximately) | 100 client/200 server/600 React |
Requirements | QBCore/Qbox |
Support | Yes |
No approved reviews found for this script yet.