jg-advancedgarages
Integration with jg-advancedgarages
This integration works only above version 2.0.9 of Gangs Script.
Using this garage system you will lose access to vehicle store function in bossmenu, garages will work only in personal mode. Garage Access permission will not work as well. We're still working on making this integration 100% working with vehicle store inside bossmenu, thanks for your patience.
Find folder: jg-advancedgarages/framework
jg-advancedgarages/frameworkInside this folder go to the file sv-functions.lua
Replace function Framework.Server.GetPlayerGang(src) with this:
function Framework.Server.GetPlayerGang(src)
if (Config.Gangs == "auto" and GetResourceState("rcore_gangs") == "started") or Config.Gangs == "rcore_gangs" then
local gang = exports.rcore_gangs:GetPlayerGang(src)
if not gang then return {} end
return {
name = gang.name,
label = gang.name,
grade = 0 -- rcore_gangs' grade system are only strings
}
elseif (Config.Gangs == "auto" and GetResourceState("op-crime") == "started") or Config.Gangs == "op-crime" then
local ident = Framework.Server.GetPlayerIdentifier(src)
local playerGang = exports['op-crime']:getPlayerOrganisation(ident)
if not playerGang then return end
return {
name = tostring("gang_" .. playerGang.orgIndex),
label = tostring(playerGang.orgData.label),
grade = 0
}
elseif (Config.Gangs == "auto" and GetResourceState("qb-gangs") == "started") or Config.Gangs == "qb-gangs" or Config.Framework == "QBCore" or Config.Framework == "Qbox" then
local player = Framework.Server.GetPlayer(src)
if not player then return false end
return {
name = player.PlayerData.gang.name,
label = player.PlayerData.gang.label,
grade = player.PlayerData.gang.grade.level
}
elseif Config.Framework == "ESX" then
-- To implement gangs in ESX, enable Config.GangEnableCustomESXIntegration & then add the necessary exports here.
-- It must return the same data structure as QB/X above, with { name, label, grade }
-- Heads up, you must also add the exports to cl-functions.lua -> Framework.Client.GetPlayerGang
error("ESX does not natively support gangs.");
end
return false
endThe same file
in the same file find function Framework.Server.GetGangs() and replace it with this:
function Framework.Server.GetGangs()
if (Config.Gangs == "auto" and GetResourceState("rcore_gangs") == "started") or Config.Gangs == "rcore_gangs" then
local gangs = MySQL.query.await("SELECT name FROM gangs")
return gangs or {}
elseif (Config.Gangs == "auto" and GetResourceState("op-crime") == "started") or Config.Gangs == "op-crime" then
local gangs = exports['op-crime']:getOrganisationsList()
local newGangs = {}
for k, v in pairs(gangs) do
table.insert(newGangs, {
name = tostring("gang_" .. v.identifier),
label = tostring("gang_" .. v.identifier),
grades = {
['0'] = { name = 'Recruit' }
}
})
end
return newGangs
elseif (Config.Gangs == "auto" and GetResourceState("qb-gangs") == "started") or Config.Gangs == "qb-gangs" then
if Config.Framework == "QBCore" then
return QBCore.Shared.Gangs
elseif Config.Framework == "Qbox" then
return exports.qbx_core:GetGangs()
end
elseif Config.Framework == "ESX" then
error("ESX does not natively support gangs.");
end
return false
endFind folder: jg-advancedgarages/framework
jg-advancedgarages/frameworkInside this folder go to the file cl-functions.lua
Inside this folder find function Framework.Client.GetPlayerGang() and replace it with this
function Framework.Client.GetPlayerGang()
if (Config.Gangs == "auto" and GetResourceState("rcore_gangs") == "started") or Config.Gangs == "rcore_gangs" then
local gang = exports.rcore_gangs:GetPlayerGang()
if not gang then return {} end
return {
name = gang.name,
label = gang.name,
grade = 0 -- rcore_gangs' grade system are only strings
}
elseif (Config.Gangs == "auto" and GetResourceState("op-crime") == "started") or Config.Gangs == "op-crime" then
local orgData = exports['op-crime']:getPlayerOrganisation()
if not orgData then return {} end
return {
name = tostring("gang_" .. orgData.id),
label = orgData.label,
grade = 0
}
elseif (Config.Gangs == "auto" and GetResourceState("qb-gangs") == "started") or Config.Gangs == "qb-gangs" or Config.Framework == "QBCore" or Config.Framework == "Qbox" then
local player = Framework.Client.GetPlayerData()
if not player or not player.gang then return {} end
return {
name = player.gang.name,
label = player.gang.label,
grade = player.gang.grade.level
}
elseif Config.Framework == "ESX" then
-- To implement gangs in ESX, enable Config.GangEnableCustomESXIntegration & then add the necessary exports here.
-- It must return the same data structure as QB/X above, with { name, label, grade }
-- Heads up, you must also add the exports to sv-functions.lua -> Framework.Server.GetPlayerGang
error("ESX does not natively support gangs.");
end
return false
endFind folder: jg-advancedgarages/framework
jg-advancedgarages/frameworkGo to the jg-advancedgarages/framework/cl-functions.lua and place this code on the end of the file.
-- Handler to fetch gang change
RegisterNetEvent("op-crime:jobChanged")
AddEventHandler('op-crime:jobChanged', function(jobId, jobLabel, rankName)
Globals.PlayerData.gang = {
name = jobId,
label = jobLabel,
grade = 0
}
Wait(5000)
TriggerEvent("jg-advancedgarages:client:update-blips-text-uis")
end)Download sv-opcrime.lua file
sv-opcrime.lua fileThis is file which adds events to inject gang garages data into jg-garages, since this garage system doesn't come with exports to open gang garage.
Last updated