Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added ESX.DeleteJob for Runtime #1281

Merged
merged 1 commit into from
Jan 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions [core]/es_extended/server/functions.lua
Original file line number Diff line number Diff line change
Expand Up @@ -417,6 +417,17 @@ function ESX.CreateJob(name, label, grades)
ESX.Jobs[name] = job
end

--- Delete Job at Runtime
function ESX.DeleteJob(name)
--- @param name string
if not name then
return print('[^3WARNING^7] missing argument `name(string)` while deleting a job')
end
MySQL.update('DELETE FROM jobs WHERE name = ?', {name})
MySQL.update('DELETE FROM job_grades WHERE job_name = ?', {name})
ESX.Jobs[name] = nil
end

function ESX.RefreshJobs()
local Jobs = {}
local jobs = MySQL.query.await('SELECT * FROM jobs')
Expand Down
Loading