42 lines
1.6 KiB
Lua
42 lines
1.6 KiB
Lua
-- You can edit the events on the right side if you for any reason don't use the default event name
|
|
|
|
EXTERNAL_EVENTS_NAMES = {
|
|
["esx:getSharedObject"] = nil, -- This is nil because it will be found automatically, change it to your one ONLY in the case it can't be found
|
|
}
|
|
|
|
--[[
|
|
You can edit this function if you want to add second jobs or anything like that (editing this function is down to you)
|
|
If you edit this, you WILL have also to edit the function in cl_integrations.lua file
|
|
]]
|
|
function hasPlayerTheCorrectJob(playerId, allowedJobs)
|
|
if(not allowedJobs) then return true end
|
|
|
|
local playerJob = Framework.getPlayerJobName(playerId)
|
|
|
|
if(allowedJobs[playerJob] == true) then -- Entire job is allowed
|
|
return true
|
|
elseif(allowedJobs[playerJob]) then
|
|
local playerJobGrade = Framework.getPlayerJobGrade(playerId)
|
|
|
|
if type(allowedJobs[playerJob]) == "table" then -- Specific grades are allowed
|
|
local stringPlayerJobGrade = tostring(playerJobGrade)
|
|
return allowedJobs[playerJob] and allowedJobs[playerJob][stringPlayerJobGrade]
|
|
elseif type(allowedJobs[playerJob]) == "number" then -- Minimum grade required
|
|
return playerJobGrade >= allowedJobs[playerJob]
|
|
end
|
|
else
|
|
return false
|
|
end
|
|
end
|
|
|
|
-- The function must return true if the player has the required item
|
|
function hasPlayerTheRequiredItem(playerId, itemName)
|
|
return Framework.hasPlayerEnoughOfItem(playerId, itemName, 1)
|
|
end
|
|
|
|
-- Edit here your police jobs
|
|
POLICE_JOBS_NAMES = {
|
|
["police"] = true,
|
|
["sheriff"] = true,
|
|
}
|