Exports

All the exports listed here are server side and should be triggered from your own resource, this will NOT work if av_laptop is not installed and running in your server.

createGroup(...)

Create a new group and assign the player as owner.

parameters:

  • playerId number: The player id server from the person who's creating it and will be designed as owner.

  • resource? string: The resource name that is triggering the export, if not provided it will return false and cancel the process.

  • maxMembers? number: The max members allowed for the group, default is 10.

  • name? string: The group name, if not defined it will use the group identifier as name.

  • password? string: The group password in case you want to make it private, optional.

  • status? string: The current group status, "N/A" if not provided.

  • ownerName? string: The owner nickname used for the group, if not provided it will use his character name or "User-" with a random number.

returns:

  • identifier false | string: If there's any problem while group creation it will return false, if the group was created it will return the group identifier as string.

local playerId = source
local resource = "av_boosting"
local maxMembers = 5
local name = "AV Scripts"
local password = false
local status = "Waiting"
local ownerName = "Avilchiis"
local identifier = exports['av_groups']:createGroup(playerId, resource, maxMembers, name, password, status, ownerName)
if identifier then
    print("Group created, identifier:"..identifier)
else
    print("Something went wrong, group couldn't be created")
end

getGroups(resource)

Get all the groups from an existing resource.

parameters:

  • resource string: Resource name you want to get a list of groups.

returns:

  • groups table

joinGroup(...)

parameters:

  • playerId number: The server id from the player who's joining the group.

  • resource? string: Resource name where the group belongs.

  • group string: Group identifier.

  • password? string: User password input, will be compared to group password.

  • nickname? string: The name used for player in the group.

returns:

  • result boolean: Returns true if player was able to join the group or false.

leaveGroup(playerId, resource, group)

parameters:

  • playerId number: The server id from the player who's leaving the group.

  • resource? string: The resource name where the group belongs.

  • group string: The group identifier.

returns:

  • result boolean: Returns true if player was removed from any group or false.

getPlayerGroup(playerId, resource)

Returns a table with the current group info.

parameters:

  • playerId number: The server id from player.

  • resource? string: The resource name where the group belongs to.

returns:

  • result boolean | table: If a group is found it will return a table with all group info, if not then it will return false.

removeMember(resource, identifier, group)

Removes the player from a group.

parameters:

  • resource? string: The resource name the group belongs to.

  • identifier string: The player identifier

  • group string: The group identifier

returns:

  • removed boolean

deleteGroup(resource, group)

parameters:

  • resource? string: The resource name the group belongs to.

  • group string: The group identifier.

returns:

  • deleted boolean

setGroupState(resource,group,status)

Sets the current status for the group, this is just in case you want to display a status in your own UI like "Waiting", "In progres", etc.

parameters:

  • resource? string: The resource name the group belongs to.

  • group string: The group identifier.

  • status string: The status to display.

returns:

  • updated boolean

Last updated