πŸ•Job system - Create job in DB

Here is an example of code that can be used to create pls_jobsystem (linkarrow-up-right) directly in the job database.

Valid for ESX only

1) Go to server.lua - Find event pls_jobsystem:server:saveNewJob

Insert the code registerJobInDatabase(jobData) under the SaveJobs() function

       if not IsJobExist(jobData.job) then
                    table.insert(Jobs, jobData)
                    lib.notify(src, {
                        title="Hell yeah!",
                        description="A new job has been created!",
                        type="success"
                    })
                    SaveJobs()

                registerJobInDatabase(jobData)
            else

Then, at the end of server.lua, insert the new function we will create.

function registerJobInDatabase(data)

end

What does the data value contain?

Function registerJobInDatabase(data)

Don't forget to add to fxmanifest.lua

IMPORTANT

This code assumes that you are using oxmysql https://github.com/overextended/oxmysql

Last updated