Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow Specific rockstar license holders to join even if the duplicate license check is enabled #1154

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions config.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
21 changes: 19 additions & 2 deletions server/events.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
-- Event Handler
local isExceptional = false


AddEventHandler('chatMessage', function(_, _, message)
if string.sub(message, 1, 1) == '/' then
Expand Down Expand Up @@ -44,6 +46,7 @@ if readyFunction ~= nil then
end

local function onPlayerConnecting(name, _, deferrals)
isExceptional = false
local src = source
deferrals.defer()

Expand All @@ -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)
Expand Down
Loading