Skip to content

nut.class

Class System module.

Manages character classes with faction restrictions, limits, and join conditions. Think of classes like classes in TF2. You have 2 "factions", RED and BLU, and within each class are 9 classes. All are within the same team/faction, yet have special features unique to the class.

Functions

nut.class.loadFromDir (directory)
nut.class.loadFromDir

Internal

This is used internally - although you're able to use it you probably shouldn't.

Register classes from a directory.

Parameters:

string directory Path to scan for class files

nut.class.canBe (client, class)
nut.class.canBe

Determines if a player is allowed to join a specific class.

Parameters:

Client client Player attempting to join

number class Class index to check

Returns:

bool Whether allowed to join

string Reason if not allowed

nut.class.get (identifier)
nut.class.get

Gets a class definition by index or ID

Parameters:

integer identifier Class index

Returns:

table Class definition table

nut.class.getPlayers (class)
nut.class.getPlayers

Gets all players in a specific class

Parameters:

number class Class index to check

Returns:

table List of player entities