diff --git a/config.lua b/config.lua index 3c773097b..75ba1ba26 100644 --- a/config.lua +++ b/config.lua @@ -113,6 +113,13 @@ QBConfig.Server.WhitelistPermission = 'admin' -- Permission that's abl QBConfig.Server.PVP = true -- Enable or disable pvp on the server (Ability to shoot other players) QBConfig.Server.Discord = '' -- Discord invite link QBConfig.Server.CheckDuplicateLicense = true -- Check for duplicate rockstar license on join +QBConfig.Server.ExceptionalLicenses = { -- If enabled, it will not check if these specified licenses are duplicate(if you want shared account players to be able to play in your server) + enabled = true, + licences = { + 'license:b2de9ea8f669f4de25d05b6fac17b4ae6f645032', + 'license:c5891bbe326c6723d5476c3378fff6495f7bc998' + } +} QBConfig.Server.Permissions = { 'god', 'admin', 'mod' } -- Add as many groups as you want here after creating them in your server.cfg QBConfig.Commands = {} -- Command Configuration diff --git a/server/events.lua b/server/events.lua index 9311e80e8..6f37ec191 100644 --- a/server/events.lua +++ b/server/events.lua @@ -1,4 +1,6 @@ -- Event Handler +local isExceptional = false + AddEventHandler('chatMessage', function(_, _, message) if string.sub(message, 1, 1) == '/' then @@ -44,6 +46,7 @@ if readyFunction ~= nil then end local function onPlayerConnecting(name, _, deferrals) + isExceptional = false local src = source deferrals.defer() @@ -69,8 +72,22 @@ local function onPlayerConnecting(name, _, deferrals) if not license then return deferrals.done(Lang:t('error.no_valid_license')) - elseif QBCore.Config.Server.CheckDuplicateLicense and QBCore.Functions.IsLicenseInUse(license) then - return deferrals.done(Lang:t('error.duplicate_license')) + elseif QBCore.Config.Server.CheckDuplicateLicense then + if QBCore.Functions.IsLicenseInUse(license) then + if QBCore.Config.Server.ExceptionalLicenses.enabled then + for _, v in pairs(QBCore.Config.Server.ExceptionalLicenses.licences) do + if license == v then + isExceptional = true + break + end + end + if not isExceptional then + return deferrals.done(Lang:t('error.duplicate_license')) + end + else + return deferrals.done(Lang:t('error.duplicate_license')) + end + end end Wait(0)