DirkScripts
Docs
Server
The groups system provides a full party/group framework with server authority, state bag synchronisation, invite flow, and task management.
#lib.registerGroup
Create a new group
lualocal groupId = lib.registerGroup(data)
| Parameter | Type | Required | Description |
|---|---|---|---|
| data | table | yes | Group definition |
#Group Data
| Field | Type | Required | Description |
|---|---|---|---|
name | string | yes | Display name for the group |
leader | number | yes | Server ID of the group leader |
maxMembers | number | no | Max group size (defaults to convar dirk_groups:maxMembers) |
metadata | table | no | Arbitrary metadata attached to the group |
#lib.getGroupById
Get the group a player belongs to
lualocal group = lib.getGroupById(memberId)
| Parameter | Type | Required | Description |
|---|---|---|---|
| memberId | number | yes | Server ID of the player |
#lib.getGroup
Get a group by its ID
lualocal group = lib.getGroup(id)
| Parameter | Type | Required | Description |
|---|---|---|---|
| id | string | yes | Group ID |
#lib.getAllGroups
Get all active groups
lualocal groups = lib.getAllGroups()
#lib.destroyGroup
Disband a group
lualib.destroyGroup(id)
#lib.addGroupMember
Add a player to a group
lualib.addGroupMember(groupId, member)
| Parameter | Type | Required | Description |
|---|---|---|---|
| groupId | string | yes | Group ID |
| member | number | yes | Server ID of the player to add |
#lib.removeGroupMember
Remove a player from a group
lualib.removeGroupMember(groupId, member)
#lib.editMemberMetadata
Update metadata for a specific group member
lualib.editMemberMetadata(groupId, member, metadata)
| Parameter | Type | Required | Description |
|---|---|---|---|
| groupId | string | yes | Group ID |
| member | number | yes | Server ID of the member |
| metadata | table | yes | Metadata to merge |
#lib.getGroupMembers
Get all members of a group
lualocal members = lib.getGroupMembers(groupId)
#lib.groupEvent
Fire a client event on all group members
lualib.groupEvent(groupId, eventName, ...)
| Parameter | Type | Required | Description |
|---|---|---|---|
| groupId | string | yes | Group ID |
| eventName | string | yes | Event to trigger |
| ... | any | no | Arguments to pass |
#lib.startGroupTask
Start a registered task for all group members
lualib.startGroupTask(groupId, taskId, taskLabel, args)
| Parameter | Type | Required | Description |
|---|---|---|---|
| groupId | string | yes | Group ID |
| taskId | string | yes | Task ID (must be registered client-side via lib.registerGroupTask) |
| taskLabel | string | yes | Display label for the active task |
| args | table | no | Arguments passed to the task's execute callback |
#lib.endGroupTask
End the active task for a group
lualib.endGroupTask(groupId, args)
| Parameter | Type | Required | Description |
|---|---|---|---|
| groupId | string | yes | Group ID |
| args | table | no | Arguments passed to the task's kill callback |
