๐Ÿšชox_doorlock usage

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.

  1. Go to pp-orgpanel/server/editable/framework and find this

RegisterNetEvent('esx:playerLoaded', function(player, xPlayer, isNew)
    [...]
end)
  1. Change this part of code to this

RegisterNetEvent('QBCore:Server:PlayerLoaded', function(player)
    local playerId = player.PlayerData.source
    local playerIdentifier = player.PlayerData.citizenid

    MySQL.Async.fetchAll('SELECT org_id FROM organization_members WHERE user_id = @identifier', {
        ['@identifier'] = playerIdentifier
    }, function(membersResult)
        if membersResult and #membersResult > 0 then
            local orgId = membersResult[1].org_id
            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(playerId).state.orgDoorlock = orgDoorlock
                end
            end)
        end
    end)
end)
  1. Below the PlayerLoaded event, add something like this to keep the door lock system in sync.

  1. Now go to ox_doorlock/server/framework/qb-core find the IsPlayerInGroup function and replace it with this

  1. 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:

doorlock group settings
  1. Restart your server and everything should work great now

Was this helpful?