@@ -26,36 +26,187 @@ Boss menu → Employees → Hire Employee → Select nearby player → Choose gr
2626
2727Hire distance: ` Config.MaxHireDistance ` in ` configs/main.lua ` (default: 20 units, -1 for unlimited).
2828
29- ### How do individual salaries work?
29+ ### How do I enable individual salaries?
30+
31+ <Tabs items = { [' ESX' , ' QBCore/QBXCore' ]} >
32+ <Tabs.Tab >
33+ In ` es_extended/server/paycheck.lua ` , find the ` local salary = ... ` line and replace it with:
34+
35+ ``` lua
36+ local salary = exports [" zerio-bossmenu" ]:GetEmployeeActiveSalary (xPlayer .identifier , xPlayer .job .name )
37+ ```
38+ </Tabs.Tab >
3039
31- Set custom salaries per employee that override role-based defaults. Integrates with framework paycheck systems.
40+ <Tabs.Tab >
41+ ** QBCore** : In ` qb-core/server/functions.lua ` (PaycheckInterval function)
42+ ** QBXCore** : In ` qbx_core/server/loops.lua ` (pay function)
43+
44+ Find the ` local payment = ... ` line and replace it with:
45+
46+ ``` lua
47+ local payment = exports [" zerio-bossmenu" ]:GetEmployeeActiveSalary (identifier , jobName )
48+ ```
49+ </Tabs.Tab >
50+
51+ </Tabs >
3252
3353### Can I fire offline employees?
3454
3555Yes, all employees show regardless of online status.
3656
37- ## 💰 Individual Salary Integration
57+ ### Setting up job role editing
3858
39- ### How do I enable individual salaries?
40-
41- <Tabs items = { [' ESX' , ' QBCore/QBXCore' ]} >
59+ <Tabs items = { [' ESX' , ' QBCore' , ' QBXCore' ]} >
4260 <Tabs.Tab >
43- In ` es_extended/server/paycheck.lua ` , replace salary calculation with:
61+ Open the ` es_extended/server/paycheck.lua ` file, and find the ` local salary = ... ` line and replace that with the line below :
4462
4563 ``` lua
4664 local salary = exports [" zerio-bossmenu" ]:GetEmployeeActiveSalary (xPlayer .identifier , xPlayer .job .name )
4765 ```
66+
67+ Also, make sure that your other scripts actually listen to the ` es_extended:updatedJobs ` event, though.
4868 </Tabs.Tab >
4969
5070 <Tabs.Tab >
51- ** QBCore** : In ` qb-core/server/functions.lua ` (PaycheckInterval function)
52- ** QBXCore** : In ` qbx_core/server/loops.lua ` (pay function)
71+ Open the ` qb-core/shared/jobs.lua ` file, and paste the following snippet at the bottom of the file:
5372
54- Replace salary calculation with:
73+ ``` lua
74+ -- INTEGRATION FOR ZERIO-BOSSMENU, DO NOT TOUCH THIS IN ANY WAY!!!! --
75+ if GetResourceState (" zerio-bossmenu" ) ~= " missing" then
76+ local prefix = IsDuplicityVersion () and " server" or " client"
77+ local registerEvent = IsDuplicityVersion () and AddEventHandler or RegisterNetEvent
78+
79+ registerEvent (" zerio-bossmenu:" .. prefix .. " :createdJobGrade" , function (jobName , gradeLevel , gradeName , salary )
80+ if not QBShared .Jobs [jobName ] then return end
81+ gradeLevel = tostring (gradeLevel )
82+ if not QBShared .Jobs [jobName ].grades [gradeLevel ] then return end
83+ QBShared .Jobs [jobName ].grades [gradeLevel ] = { name = gradeName , payment = salary }
84+ QBCore .Shared .Jobs [jobName ].grades [gradeLevel ] = { name = gradeName , payment = salary }
85+ TriggerEvent (" zerio-bossmenu:" .. prefix .. " :updatedSharedJobs" , QBShared .Jobs )
86+ end )
87+
88+ registerEvent (" zerio-bossmenu:" .. prefix .. " :updatedJobGrade" , function (jobName , gradeLevel , gradeName , salary )
89+ if not QBShared .Jobs [jobName ] then return end
90+ gradeLevel = tostring (gradeLevel )
91+ if not QBShared .Jobs [jobName ].grades [gradeLevel ] then return end
92+ QBShared .Jobs [jobName ].grades [gradeLevel ].name = gradeName
93+ QBShared .Jobs [jobName ].grades [gradeLevel ].payment = salary
94+ QBCore .Shared .Jobs [jobName ].grades [gradeLevel ].name = gradeName
95+ QBCore .Shared .Jobs [jobName ].grades [gradeLevel ].payment = salary
96+ TriggerEvent (" zerio-bossmenu:" .. prefix .. " :updatedSharedJobs" , QBShared .Jobs )
97+ end )
98+
99+ registerEvent (" zerio-bossmenu:" .. prefix .. " :deletedJobGrade" , function (jobName , gradeLevel )
100+ if not QBShared .Jobs [jobName ] then return end
101+ gradeLevel = tostring (gradeLevel )
102+ QBShared .Jobs [jobName ].grades [gradeLevel ] = nil
103+ QBCore .Shared .Jobs [jobName ].grades [gradeLevel ] = nil
104+ TriggerEvent (" zerio-bossmenu:" .. prefix .. " :updatedSharedJobs" , QBShared .Jobs )
105+ end )
106+
107+ if IsDuplicityVersion () then
108+ AddEventHandler (" qb-core:server:updateSharedJobsFile" , function (data , cb )
109+ local oldData = LoadResourceFile (GetCurrentResourceName (), " shared/jobs.lua" )
110+ if oldData then
111+ SaveResourceFile (GetCurrentResourceName (), " backups/jobs" .. tostring (os.time ()) .. " .lua" , oldData , - 1 )
112+ end
113+ cb (SaveResourceFile (GetCurrentResourceName (), " shared/jobs.lua" , data , - 1 ))
114+ end )
115+ end
116+ else
117+ CreateThread (function ()
118+ while true do
119+ warn (" Tried to load zerio-bossmenu job integration, but zerio-bossmenu seems to be missing?" )
120+ Wait (500 )
121+ end
122+ end )
123+ end
124+ -- END OF ZERIO-BOSSMENU INTEGRATION --
125+ ```
126+
127+ Open the ` qb-core/shared/gangs.lua ` file, and paste the following snippet at the bottom of the file:
55128
56129 ``` lua
57- local salary = exports [" zerio-bossmenu" ]:GetEmployeeActiveSalary (identifier , jobName )
130+ -- INTEGRATION FOR ZERIO-BOSSMENU, DO NOT TOUCH THIS IN ANY WAY!!!! --
131+ if GetResourceState (" zerio-bossmenu" ) ~= " missing" then
132+ local prefix = IsDuplicityVersion () and " server" or " client"
133+ local registerEvent = IsDuplicityVersion () and AddEventHandler or RegisterNetEvent
134+
135+ registerEvent (" zerio-bossmenu:" .. prefix .. " :createdGangGrade" , function (jobName , gradeLevel , gradeName )
136+ if not QBShared .Gangs [jobName ] then return end
137+ gradeLevel = tostring (gradeLevel )
138+ if not QBShared .Gangs [jobName ].grades [gradeLevel ] then return end
139+ QBShared .Gangs [jobName ].grades [gradeLevel ] = { name = gradeName }
140+ QBCore .Shared .Gangs [jobName ].grades [gradeLevel ] = { name = gradeName }
141+ TriggerEvent (" zerio-bossmenu:" .. prefix .. " :updatedSharedGangs" , QBShared .Gangs )
142+ end )
143+
144+ registerEvent (" zerio-bossmenu:" .. prefix .. " :updatedGangGrade" , function (jobName , gradeLevel , gradeName )
145+ if not QBShared .Gangs [jobName ] then return end
146+ gradeLevel = tostring (gradeLevel )
147+ if not QBShared .Gangs [jobName ].grades [gradeLevel ] then return end
148+ QBShared .Gangs [jobName ].grades [gradeLevel ].name = gradeName
149+ QBCore .Shared .Gangs [jobName ].grades [gradeLevel ].name = gradeName
150+ TriggerEvent (" zerio-bossmenu:" .. prefix .. " :updatedSharedGangs" , QBShared .Gangs )
151+ end )
152+
153+ registerEvent (" zerio-bossmenu:" .. prefix .. " :deletedGangGrade" , function (jobName , gradeLevel )
154+ if not QBShared .Gangs [jobName ] then return end
155+ gradeLevel = tostring (gradeLevel )
156+ QBShared .Gangs [jobName ].grades [gradeLevel ] = nil
157+ QBCore .Shared .Gangs [jobName ].grades [gradeLevel ] = nil
158+ TriggerEvent (" zerio-bossmenu:" .. prefix .. " :updatedSharedGangs" , QBShared .Gangs )
159+ end )
160+
161+ if IsDuplicityVersion () then
162+ AddEventHandler (" qb-core:server:updateSharedGangsFile" , function (data , cb )
163+ local oldData = LoadResourceFile (GetCurrentResourceName (), " shared/gangs.lua" )
164+ if oldData then
165+ SaveResourceFile (GetCurrentResourceName (), " backups/jobs" .. tostring (os.time ()) .. " .lua" , oldData , - 1 )
166+ end
167+ cb (SaveResourceFile (GetCurrentResourceName (), " shared/gangs.lua" , data , - 1 ))
168+ end )
169+ end
170+ else
171+ CreateThread (function ()
172+ while true do
173+ warn (" Tried to load zerio-bossmenu job integration, but zerio-bossmenu seems to be missing?" )
174+ Wait (500 )
175+ end
176+ end )
177+ end
178+ -- END OF ZERIO-BOSSMENU INTEGRATION --
58179 ```
180+
181+ Create a folder called ` backups ` in your ` qb-core ` folder, and make sure that the ` qb-core ` folder is writable.
182+
183+ For scripts you want to integrate with this, you can listen to the ` zerio-bossmenu:server:updatedSharedJobs ` , ` zerio-bossmenu:client:updatedSharedJobs ` , ` zerio-bossmenu:server:updatedSharedGangs ` and ` zerio-bossmenu:client:updatedSharedGangs ` events.
184+ </Tabs.Tab >
185+
186+ <Tabs.Tab >
187+ Open the ` qbx_core/server/events.lua ` file, and paste the following snippet at the bottom of the file:
188+
189+ ``` lua
190+ AddEventHandler (" qb-core:server:updateSharedGangsFile" , function (data , cb )
191+ local oldData = LoadResourceFile (GetCurrentResourceName (), " shared/gangs.lua" )
192+ if oldData then
193+ SaveResourceFile (GetCurrentResourceName (), " backups/gangs" .. tostring (os.time ()) .. " .lua" , oldData , - 1 )
194+ end
195+ cb (SaveResourceFile (GetCurrentResourceName (), " shared/gangs.lua" , data , - 1 ))
196+ end )
197+
198+ AddEventHandler (" qb-core:server:updateSharedJobsFile" , function (data , cb )
199+ local oldData = LoadResourceFile (GetCurrentResourceName (), " shared/jobs.lua" )
200+ if oldData then
201+ SaveResourceFile (GetCurrentResourceName (), " backups/jobs" .. tostring (os.time ()) .. " .lua" , oldData , - 1 )
202+ end
203+ cb (SaveResourceFile (GetCurrentResourceName (), " shared/jobs.lua" , data , - 1 ))
204+ end )
205+ ```
206+
207+ Create a folder called ` backups ` in your ` qbx_core ` folder, and make sure that the ` qbx_core ` folder is writable.
208+
209+ For scripts you want to integrate with this, you can listen to qbox's official ` qbx_core:server:onJobUpdate ` and ` qbx_core:client:onJobUpdate ` events.
59210 </Tabs.Tab >
60211
61212</Tabs >
0 commit comments