Skip to content

Commit

Permalink
Merge pull request #1281 from t1ger-scripts/patch-1
Browse files Browse the repository at this point in the history
Added ESX.DeleteJob for Runtime
  • Loading branch information
Arctos2win authored Jan 14, 2024
2 parents a88846f + 6fa81e2 commit 3b13fe2
Showing 1 changed file with 11 additions and 0 deletions.
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

0 comments on commit 3b13fe2

Please sign in to comment.