Duty Sistem
Unlike the classic duty system that sets a new job, this system works with a simple variable that is saved in the database.
Configurable
Very easy to configure, and usable for any job
Optimization
The script has been created in order to create the least amount of lag both client and server side
Example Usage and Config
- Config Setting
--config.lua :
Position = {
{ job = "polizia", grademin = 0, x = 441.06674194336, y = -978.576171875, z = 30.689609527588}
}
--put on job the job that the marker can see, in grademin the minimum grade of the job that the marker can see and in x, y, z, the marker position
- Examples of use (Server Side)
-- Request Code
if ExampleChekJobInDutyOnline("police") > 1 then --As argument put the job to check
--in this case the "ExampleChekJobInDutyOnline" function gives you the number of "police" online and in service, useful for carrying out checks for robberies or for paycheck
end
-- Function
ExampleChekJobInDutyOnline = function (job)
local count = 0
for index, player in pairs(GetPlayers()) do
if tonumber(player) ~= nil then
local xPlayer = ESX.GetPlayerFromId(tonumber(player))
local inDuty = exports["mxm_duty"]:getDuty(tonumber(player))
if xPlayer then
if xPlayer.job.name == job and inDuty then
count = count + 1
end
end
end
end
return count
end
- Examples of use (Client Side)
local inDuty = exports["mxm_duty"]:getClienDuty()
if inDuty then
--print("in Duty")
else
--print("Off Duty")
end
Github: GitHub - MaXxaM2611/mxm_duty: --Readme https://fenixhub.dev/readme_duty.html