updateGangRankData

This updates the ranks data for the rank from the ranks id

Usage

local updatedGangRank = exports.gfg_gangs:updateGangRankData(id, rank, name, label, canRecruit, canManage, isBoss)
  • id: int (The id of the rank you wish to update)

  • rank: int (The rank of the rank, where it sits in the hierarchy)

  • name: string (The name of the rank)

  • label: string (The label of the rank)

  • canRecruit: int (Whether or not that rank has recruitment ability, 0 being no, 1 being yes)

  • canManage: int (Whether or not that rank has management ability, 0 being no, 1 being yes)

  • isBoss: int (Whether or not that rank has boss ability, 0 being no, 1 being yes)

Returns: table (The updated rank data)

  • id: int (The id of the rank)

  • gang_name: string (The name of the gang the rank is associated with)

  • rank: int (The rank of the rank, where it sits in the hierarchy)

  • name: string (The name of the rank)

  • label: string (The label of the rank)

  • canRecruit: int (Whether or not that rank has recruitment ability, 0 being no, 1 being yes)

  • canManage: int (Whether or not that rank has management ability, 0 being no, 1 being yes)

  • isBoss: int (Whether or not that rank has boss ability, 0 being no, 1 being yes)

Example

-- This gets the current player gang
local playerGang = exports.gfg_gangs:getPlayerGangInfoFromId()

-- This Retrieves all the rank data from the players gang
local playerGangRanks = exports.gfg_gangs:getGangRankData(playerGang.name)

print("Player Gang Ranks:")
print(json.encode(playerGangRanks, {indent = true}))

--[[
    playerGangRanks = {
        {
            id = 1,
            gang_name: "gfg",
            rank = 0,
            name = "recruit",
            label = "Recruit",
            canRecruit = 0,
            canManage = 0,
            isBoss = 0
        },
        {
            id = 2,
            gang_name: "gfg",
            rank = 1,
            name = "member",
            label = "Member",
            canRecruit = 1,
            canManage = 1,
            isBoss = 0
        },
        {
            id = 3,
            gang_name: "gfg",
            rank = 2,
            name = "boss",
            label = "Boss",
            canRecruit = 1,
            canManage = 1,
            isBoss = 1
        },
]]

-- This finds the current players rank data from his rank.
for _, rank in pairs(PlayerGangRanks) do
    if playerGang.rank == rank.rank then
        rankToUpdate = rank
    end
end

-- This takes the current player rank data that we just found and updates the rank so the player (and anyone with that rank) can now recruit
local updatedGangRank = exports.gfg_gangs:updateGangRankData(rankToUpdate.id, rankToUpdate.rank, rankToUpdate.name, rankToUpdate.label, 1, rankToUpdate.canManage, rankToUpdate.isBoss)

print("Updated Gang Rank Data:")
print(json.encode(updatedGangRank, {indent = true}))

--[[
    updatedGangRank = {
        id = 1,
        gang_name: "gfg",
        rank = 0,
        name = "recruit",
        label = "Recruit",
        canRecruit = 1,
        canManage = 0,
        isBoss = 0
    }
]]

Last updated