-
Notifications
You must be signed in to change notification settings - Fork 10
Methods ‐ Faction
Actionbot edited this page Feb 28, 2024
·
8 revisions
Called when the default name for a character needs to be retrieved (i.e upon initial character creation).
client - Client to get the default name for
String
Defines the default name for the newly created character
function FACTION:getDefaultName(client)
return "CT-" .. math.random(111111, 999999) -- This will set their name as CT-XXXXXX where as those 6 numerals are random generated
end
Called when a character has been initally created and assigned to this faction.
client - Client that owns the character
character - Character that has been created
Mostly used to add items/set values on character creation.
function FACTION:OnCharCreated(client, character)
local inventory = character:getInv()
inventory:add("fancy_suit") -- Adds a Fancy Suit Item
end
Called when a character in this faction has (re)spawned in the world.
client - Client that has just spawned
To run certain functions on spawn.
FACTION.Health = 500 -- Defines that Faction HP
FACTION.Armor = 50 -- Defines that Faction Armor
function FACTION:onSpawn(client)
client:SetMaxHealth(self.Health) -- Sets Faction Max HP to client
client:SetHealth(self.Health) -- Sets Faction HP to client
client:SetArmor(self.Armor) -- Sets Armor Max HP to client
client:SetMaxArmor(self.Armor) -- Sets Armor HP to client
end
Called when a player's character has been transferred to this faction.
character - Character that was transferred
Allows you to run functions on faction transfer
function FACTION:onTransfered(character)
character:setModel(table.Random(FACTION.models)) -- Sets your model as your FACTION.Model
end