lia.faction
Helper library for loading/getting faction information.
If you are looking for the faction structure, you can find it here.
Functions
formatModelData()
This is an internal function! You are able to use it, but you risk unintended side effects if used incorrectly.
Iterates through faction model data and formats the model groups. This function is used to ensure consistency and correctness in model group data.
get(identifier)
Retrieves a faction table.
Parameters
-
identifier
Integer
Index or name of the faction
Returns
-
table
Faction table
Example Usage
print(lia.faction.get(Entity(1):Team()).name)
> "Citizen"
getClasses(faction)
Returns a table containing the classes associated with a faction.
Parameters
-
faction
Integer
number The index of the faction
Returns
-
table
A table containing the indices of the classes associated with the faction
getDefaultClass(id)
Retrieves the default class of a specified faction. The default class is determined based on the faction index and the 'isDefault' flag set for each class.
Parameters
-
id
Integer
The index of the faction for which to retrieve the default class.
Returns
-
any
tab|nil Information about the default class if found, nil otherwise.
getIndex(uniqueID)
Retrieves a faction index.
Parameters
-
uniqueID
String
Unique ID of the faction
Returns
-
number
Faction index
getPlayerCount(faction)
Returns the number of players belonging to a specific faction.
Parameters
-
faction
Integer
number The index of the faction
Returns
-
number
The number of players belonging to the specified faction
getPlayers(faction)
Returns a table containing the players belonging to a specific faction.
Parameters
-
faction
Integer
number The index of the faction
Returns
-
table
A table containing the players belonging to the specified faction
hasWhitelist(faction)
Returns true if a faction requires a whitelist.
Parameters
-
faction
Integer
Index of the faction
Returns
-
bool
Whether or not the faction requires a whitelist
isFactionCategory(faction, categoryFactions)
Checks if a given faction is part of a specified category of factions.
Parameters
-
faction
Integer
The index of the faction to check.
-
categoryFactions
Table
A table containing faction indices that define the category.
Returns
-
bool
True if the faction is in the category, false otherwise.
jobGenerate(index, name, color, default, models)
This function is an example of how to create a custom faction using lia.faction.jobGenerate. It is not recommended to use this method directly as it may lead to unexpected behavior. Instead, consider using more appropriate methods provided by the framework, such as faction files.
Parameters
-
index
Integer
The index of the faction. This should be a unique numerical identifier for the faction.
-
name
String
The name of the faction.
-
color
Table
The color of the faction.
-
default
Boolean
Whether the faction is default or not.
-
models
Table
The models associated with the faction.
Example Usage
lia.faction.jobGenerate(9, "Custom Faction", Color(255, 0, 0), false, {"models/player/custom_model.mdl", "models/player/custom_accessory.mdl"})
lia.faction.jobGenerate(10, "Another Custom Faction", Color(255, 255, 0), false, lia.faction.DefaultModels)
loadFromDir(directory)
Loads factions from a directory.
Parameters
-
directory
String
The path to the factions files.