Custom ESX Jobs is a resource created by TIGO which combine all jobs in one working script. By modifying ESX and expanding es_extended, it is possible to work with permissions and adjust everything in real time. Jobs can be edited or added while the server is running (deleting a job must be done manually).
- Copy esx_customJobs to your FXServer resource folder
- Run the esx_customJobs.sql file in your FXServer database
- Rename esx_customJobs to esx_customjobs (all lowercase)
- Add esx_customjobs to your sever.cfg file
- Start your server or resource
job_account
, job_safe
and job_weapon
To update jobs in real time, you need to modify your es_extended
.
Add the function to @es_extended/server/common.lua
.
AddEventHandler('esx:updateJob', function(job, grades)
ESX.Jobs[job.name] = job
ESX.Jobs[job.name].grades = grades
if (ESX.Table.SizeOf(ESX.Jobs[job.name].grades) == 0) then
ESX.Jobs[job.name] = nil
print(('[es_extended] [^3WARNING^7] Ignoring job "%s" due to no job grades found'):format(job.name))
end
for source, xPlayer in pairs(ESX.Players) do
if (xPlayer ~= nil and xPlayer.job ~= nil and xPlayer.job.name == job.name) then
local currentGrade = xPlayer.job.grade or 0
local playerGradeExists = ESX.Jobs[job.name] ~= nil and ESX.Jobs[job.name].grades[tostring(currentGrade)] ~= nil
if (playerGradeExists) then
xPlayer.setJob(job.name, currentGrade)
else
xPlayer.setJob('unemployed', 0)
end
end
end
end)
PermissionGroup | Permission | Description |
---|---|---|
safe.item.* |
safe.item.add |
You can put items in the safe |
safe.item.* |
safe.item.remove |
You can remove items from the safe |
safe.item.* |
safe.item.buy |
You can buy items for the safe |
safe.weapon.* |
safe.weapon.add |
You can put weapons in the safe |
safe.weapon.* |
safe.weapon.remove |
Your can remove weapons from the safe |
safe.weapon.* |
safe.weapon.buy |
You can buy weapons for the safe |
safe.account.* |
safe.account.add |
You can add account money |
safe.account.* |
safe.account.remove |
You can remove account money |
wardrobe.* |
wardrobe.use |
You can use the wardrobe |
vehicle.* |
vehicle.spawn |
You can spawn job vehicles |
vehicle.* |
vehicle.park |
You can despawn vehicles |
When the balance of a job has been updated
Argument | Data Type | Optional | Default Value | Explanation |
---|---|---|---|---|
jobName | string | false | 'unknown' | Name of the organisation |
account | string | false | Account that has been updated | |
money | number | false | 0 | New balance of account |
AddEventHandler('esx_jobs:setJobMoney', function(jobName, account, money)
....
end)
When money has been added to a job account balance
Argument | Data Type | Optional | Default Value | Explanation |
---|---|---|---|---|
jobName | string | false | 'unknown' | Name of the organisation |
account | string | false | Account that has been added | |
money | number | false | 0 | Added money |
AddEventHandler('esx_jobs:addMoney', function(jobName, account, money)
....
end)
When money has been removed from a job account balance
Argument | Data Type | Optional | Default Value | Explanation |
---|---|---|---|---|
jobName | string | false | 'unknown' | Name of the organisation |
account | string | false | Account that has been removed | |
money | number | false | 0 | Removed money |
AddEventHandler('esx_jobs:removeMoney', function(jobName, account, money)
....
end)
When a new balance is set to job account
Argument | Data Type | Optional | Default Value | Explanation |
---|---|---|---|---|
jobName | string | false | 'unknown' | Name of the organisation |
account | string | false | Account that has been set | |
money | number | false | 0 | New account balance |
AddEventHandler('esx_jobs:setMoney', function(jobName, account, money)
....
end)
When the number of job items has been updated
Argument | Data Type | Optional | Default Value | Explanation |
---|---|---|---|---|
jobName | string | false | 'unknown' | Name of the organisation |
itemName | string | false | Item that has been updated | |
count | number | false | 0 | New count of item |
AddEventHandler('esx_jobs:setJobItem', function(jobName, itemName, count)
....
end)
When items has been added to job item
Argument | Data Type | Optional | Default Value | Explanation |
---|---|---|---|---|
jobName | string | false | 'unknown' | Name of the organisation |
itemName | string | false | Item that has been added | |
count | number | false | 0 | Number of added items |
AddEventHandler('esx_jobs:addItem', function(jobName, itemName, count)
....
end)
When items has been removed to job item
Argument | Data Type | Optional | Default Value | Explanation |
---|---|---|---|---|
jobName | string | false | 'unknown' | Name of the organisation |
itemName | string | false | Item that has been removed | |
count | number | false | 0 | Number of removed items |
AddEventHandler('esx_jobs:removeItem', function(jobName, itemName, count)
....
end)
When a new count is set to job item
Argument | Data Type | Optional | Default Value | Explanation |
---|---|---|---|---|
jobName | string | false | 'unknown' | Name of the organisation |
itemName | string | false | Item that has been set | |
count | number | false | 0 | New count of item |
AddEventHandler('esx_jobs:setItem', function(jobName, itemName, count)
....
end)
MIT License
Copyright (c) 2020 Thymon Arens (TigoDevelopment)
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
This resource was created by me with all the knowledge at the time of writing. The request for new functionality is allowed but it does not mean that it will be released. Further development of this resource is permitted.