From b54ac9e7b4d4a5b58bae406bb27334699235710a Mon Sep 17 00:00:00 2001 From: Solareon <769465+solareon@users.noreply.github.com> Date: Tue, 13 Aug 2024 22:11:00 +0200 Subject: [PATCH] feat(server/functions): GetGroupMembers export --- server/functions.lua | 8 +++++++- server/storage/players.lua | 8 ++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) 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, }