Server Exports

Here you will find all the useful exports for this asset, please read each step and example carefully to better understand how it works, we do not recommend using these if you are not an experienced developer.


GetGangFromSource

Check a player's gang using their source as identification.

-- source: Player source
exports['qs-gangs']:GetGangFromSource(source)

getGangs

Export to sync the player's gang id

exports['qs-gangs']:getGangs()

An example of using this system would be the following.

function SyncGangSystem()
    local gangs = exports['qs-gangs']:getGangs()
    local data = {}
    for name in pairs(gangs) do
        table.insert(data, name)
    end
    initCustomGangs(data)
end

setGang

Export to give or remove gang.

-- Set gang to player id
exports['qs-gangs']:setGang(id, gangName)

An example of using this system would be the following.

-- Set Gang example
function AddGangSystemMember(id, gangID)
    local foundGang
    for _, v in ipairs(Gangs) do
        if v.id == gangID then
            foundGang = v
            break
        end
    end
    if not foundGang then return end
    local success, errorMessage = exports['qs-gangs']:setGang(id, foundGang.gangName)
    if not success then
        print('^1[^3ERROR^1] Failed to add gang to player: ' .. errorMessage)
    end
end

-- Remove Gang example
function RemoveGangSystemMember(id, gangID)
    local success, errorMessage = exports['qs-gangs']:setGang(id, 'none')
    if not success then
        print('^1[^3ERROR^1] Failed to remove gang from player: ' .. errorMessage)
    end
end

Last updated