Skip to content

Add gang-based radio channel restrictions#66

Open
AndyBodnar wants to merge 1 commit into
qbcore-framework:mainfrom
AndyBodnar:feature/gang-radio-restrictions
Open

Add gang-based radio channel restrictions#66
AndyBodnar wants to merge 1 commit into
qbcore-framework:mainfrom
AndyBodnar:feature/gang-radio-restrictions

Conversation

@AndyBodnar
Copy link
Copy Markdown

Summary

Adds native support for gang-based radio channel restrictions alongside existing job restrictions.

  • Players with a matching job (when on duty) OR matching gang can access restricted channels
  • Updated config format to support both jobs and gangs arrays
  • Works on both client-side and server-side (pma-voice) validation

New Config Format

Config.RestrictedChannels = {
    -- Job-only channel
    [1] = { jobs = { "police", "ambulance" } },

    -- Gang-only channel
    [500] = { gangs = { "ballas", "vagos" } },

    -- Mixed channel (job OR gang can access)
    [999] = { jobs = { "police" }, gangs = { "lostmc" } }
}

Changes

  • config.lua: New format with documentation, supports jobs and gangs arrays
  • client.lua: Added HasChannelAccess() function to check both job and gang access
  • server.lua: Added HasChannelAccess() for pma-voice channel validation

Test plan

Tested with LuaGround (21 tests passed):

  • Job-only channels work as before
  • Gang-only channels allow matching gangs
  • Mixed channels allow job OR gang access
  • Unrestricted channels remain open
  • Server-side validation works correctly

Test file: https://github.com/AndyBodnar/LuaGround/blob/main/tests/qb_radio_gang_test.lua

Fixes #65

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[SUGGESTION] Support for gangs to have radio restriction.

1 participant