Faction skeleton w/examples and comments to explain.
Code:
local FACTION = Clockwork.faction:New("") -- Faction name
FACTION.useFullName = true -- Whether or not to use full names for the faction
FACTION.isCombineFaction = false -- Whether or not the faction is a Combine faction
FACTION.whitelist = true -- Whether or not you need a whitelist to join the faction
FACTION.material = "" -- The image displayed for the faction during character creation
FACTION.models = { -- The models used by the faction
female = {
"models/humans/group01/female_01.mdl",
"models/humans/group01/female_02.mdl"},
male = {
"models/humans/group01/male_01.mdl",
"models/humans/group01/male_02.mdl"}
}
-- Called when a player's name should be assigned for the faction.
function FACTION:GetName(player, character)
end
-- Called when a player's model should be assigned for the faction.
function FACTION:GetModel(player, character)
if (character.gender == GENDER_MALE) then
return self.models.male[1]
else
return self.models.female[1]
end
end
-- Called when a player is transferred to the faction.
function FACTION:OnTransferred(player, faction, name)
if (player:QueryCharacter("gender") == GENDER_MALE) then
player:SetCharacterData("model", self.models.male[1], true)
else
player:SetCharacterData("model", self.models.female[1], true)
end
end
FACTION_FACTIONENUM = FACTION:Register() -- Change FACTIONENUM to a unique title for your faction (preferably a shortened version of the faction name)