#Managing player groups
Player groups are a way to organize players into groups, and then assign permissions to those groups. This way, you can easily manage permissions for multiple players at once.
#Attaching player to a group Async
To attach a player to a group, you can use the useAccount
, useCharacter
and useVirtual
functions. All of them have a groups
property that you can use to attach a player to a group.
Event will be triggered
This will trigger a rebar:permissions:groups:add
event with following arguments:
player: alt.Player
— player that group was added to.group: string
— group that was added to character.target: 'character' | 'account'
— target of the operation.
#Removing player from a group Async
To remove a player from a group, you can use the useAccount
, useCharacter
and useVirtual
functions. All of them have a groups
property that you can use to remove a player from a group.
Event will be triggered
This will trigger a rebar:permissions:groups:remove
event with following arguments:
player: alt.Player
— player that group was removed from.group: string
— group that was removed from character.target: 'character' | 'account'
— target of the operation.
#Clearing all groups Async
To clear all groups from a player, you can use the useAccount
, useCharacter
and useVirtual
functions. All of them have a groups
property that you can use to clear all groups from a player.
Event will be triggered
This will trigger a rebar:permissions:groups:clear
event with following arguments:
player: alt.Player
— player that groups were cleared from.groups: string[]
— groups that were cleared from character.target: 'character' | 'account'
— target of the operation.
#Getting a list of groups
To get a list of groups that a player is in, you can use the useAccount
, useCharacter
and useVirtual
functions. All of them have a groups
property that you can use to get a list of groups.
#Check group membership
To check if a player is a member of a group, you can use the useAccount
, useCharacter
and useVirtual
functions. All of them have a groups
property that you can use to check if a player is a member of a group.