Unfortunately, ox_doorlock does not provide functions that will help us grant doorlock access to a member of the organization, so one solution may be to use it as follows.
Go to pp-orgpanel/server/editable/framework and find this
if interiorsResult and #interiorsResult > 0 then
local orgDoorlock = interiorsResult[1].doorlock
Player(xPlayer.source).state.orgDoorlock = orgDoorlock
end
Below the playerLoaded event, add something like this to keep the door lock system in sync.
RegisterNetEvent('pp-orgpanel:memberAdded', function(orgId, sourceId, targetId)
MySQL.Async.fetchAll('SELECT doorlock FROM organization_interiors WHERE org_id = @org_id', {
['@org_id'] = orgId
}, function(interiorsResult)
if interiorsResult and #interiorsResult > 0 then
local orgDoorlock = interiorsResult[1].doorlock
Player(targetId).state.orgDoorlock = orgDoorlock
end
end)
end)
RegisterNetEvent('pp-orgpanel:memberFired', function(targetId)
Player(targetId).state.orgDoorlock = nil
end)
RegisterNetEvent('pp-orgpanel:memberLeaved', function(orgId, targetId)
Player(targetId).state.orgDoorlock = nil
end)
Now go to ox_doorlock/server/framework/es_extended find the IsPlayerInGroup function and replace it with this
function IsPlayerInGroup(player, filter)
local type = type(filter)
local currentOrg = Player(player.source).state.orgDoorlock
if type == 'string' then
if player.job.name == filter or currentOrg == filter then
return true
end
else
local tabletype = table.type(filter)
if tabletype == 'hash' then
local grade = filter[player.job.name]
if grade and grade <= player.job.grade or filter[currentOrg] then
return true
end
elseif tabletype == 'array' then
for i = 1, #filter do
if player.job.name == filter[i] or currentOrg == filter[i] then
return true
end
end
end
end
return false
end
Now set the interior doorlock in pp-orgpanel/config_c/Config.interiors to the same name as the group in the doorlock settings, for example: