lia.class

Helper library for loading/getting class information.

Classes are temporary assignments for characters - analogous to a "job" in a faction. For example, you may have a police faction in your schema, and have "police recruit" and "police chief" as different classes in your faction. Anyone can join a class in their faction by default, but you can restrict this as you need with CLASS.OnCanBe.

If you are looking for the class structure, you can find it here.

Functions

canBe(client, class)

Checks if a player can join a particular class.

Parameters

  • client Player

    The player wanting to join the class.

  • class Integer

    The identifier of the class.

Returns

  • any

    bool Whether the player can join the class.

  • any

    string Reason for the failure, if any.

get(identifier)

Retrieves information about a class.

Parameters

  • identifier Integer

    The identifier of the class.

Returns

  • any

    tab Information about the class.

getPlayerCount(class)

Retrieves the count of players belonging to a specific class.

Parameters

  • class Integer

    The identifier of the class.

Returns

  • any

    int The count of players belonging to the class.

getPlayers(class)

Retrieves a list of players belonging to a specific class.

Parameters

  • class Integer

    The identifier of the class.

Returns

  • any

    tab List of players belonging to the class.

hasWhitelist(class)

Checks if a class has an whitelist.

Parameters

  • class Integer

    The identifier of the class.

loadFromDir(directory)

Loads class information from Lua files in the specified directory.

Parameters

  • directory String

    The directory path from which to load class Lua files.

retrieveClass(class)

Retrieves the identifier of a class based on its unique ID or name.

Parameters

  • class String

    The unique ID or name of the class.

Returns

  • any

    int The identifier of the class if found, nil otherwise.