diff --git a/server/functions.lua b/server/functions.lua index cafbb708d..297beb671 100644 --- a/server/functions.lua +++ b/server/functions.lua @@ -477,4 +477,10 @@ local function isGradeBoss(group, grade) return groupData[grade].IsBoss end -exports('IsGradeBoss', isGradeBoss) \ No newline at end of file +exports('IsGradeBoss', isGradeBoss) + +local function getGroupMembers(group, type) + return storage.fetchGroupMembers(group, type) +end + +exports('GetGroupMembers', getGroupMembers) \ No newline at end of file diff --git a/server/storage/players.lua b/server/storage/players.lua index 2ae51af85..83a55d59b 100644 --- a/server/storage/players.lua +++ b/server/storage/players.lua @@ -231,6 +231,13 @@ local function fetchPlayerGroups(citizenid) return jobs, gangs end +---@param group string +---@param type GroupType +---@return table players +local function fetchGroupMembers(group, type) + return MySQL.query.await("SELECT citizenid, grade FROM player_groups WHERE `group` = ? AND `type` = ?", {group, type}) +end + ---@param citizenid string ---@param type GroupType ---@param group string @@ -316,6 +323,7 @@ return { addPlayerToJob = addPlayerToJob, addPlayerToGang = addPlayerToGang, fetchPlayerGroups = fetchPlayerGroups, + fetchGroupMembers = fetchGroupMembers, removePlayerFromJob = removePlayerFromJob, removePlayerFromGang = removePlayerFromGang, }