βΊοΈMembers Status
The basics to get Members Status.
QBCore.Functions.TriggerCallback('CheckGroupStatus', function(status, errorMessage)
if status then
Wait(100)
-- Event?
else
lib.notify({
title = 'Example',
position = 'bottom',
description = errorMessage,
type = 'error'})
end
end, GroupID)
QBCore.Functions.CreateCallback("CheckGroupStatus", function(source, cb, groupID)
local loadFile = LoadResourceFile('nelo-tablet', "groups.json")
local groups = loadFile and json.decode(loadFile) or { groups = {} }
local notReadyMembers = {}
for _, group in pairs(groups.groups) do
if group.groupID == groupID then
for _, member in pairs(group.members) do
if not member.StatusReadyMember then
table.insert(notReadyMembers, member.name)
end
end
if #notReadyMembers > 0 then
local errorMessage = lang.gmembersnotready .. table.concat(notReadyMembers, ", ")
cb(false, errorMessage)
else
cb(true)
end
return
end
end
cb(false, "Group not found.")
end)
You can use this for a pre-task check to require everyone to be ready.
Last updated