Configuration¶
This page documents hooks in the configuration category.
CanPlayerModifyConfig(client, key)View Source
Purpose
Allows plugins or modules to control whether a player may view or modify configuration values.
Category
Configuration
Realm
Shared
Parameters
Player client The player attempting to access or modify configuration values.
string key The configuration key being modified. This argument is only provided during a configuration change.
Returns
boolean|nil Return false to block access or modification. Return nil or true to allow it.
Example Usage
hook.Add("CanPlayerModifyConfig", "liaExampleCanPlayerModifyConfig", function(client, key)
if IsValid(client) and client:IsAdmin() then
return true
end
end)
ConfigChanged(key, newValue, oldValue, client)View Source
Purpose
Runs on the server after a player successfully changes a configuration value.
Category
Configuration
Realm
Server
Parameters
string key The configuration key that changed.
any newValue The new value assigned to the configuration key.
any oldValue The previous value for the configuration key.
Player client The player who changed the configuration value.
Example Usage
hook.Add("ConfigChanged", "liaExampleConfigChanged", function(key, newValue, oldValue, client)
if not IsValid(client) then return end
print(string.format("[MyModule] handled ConfigChanged for %s", client:Name()))
end)
CreateSalaryTimers()View Source
DermaSkinChanged(skin)View Source
Purpose
Runs when the `DermaSkin` configuration value changes.
Category
Configuration
Realm
Shared
Parameters
string skin The selected Derma skin name.
Example Usage
hook.Add("DermaSkinChanged", "liaExampleDermaSkinChanged", function(skin)
print("[MyModule] handled DermaSkinChanged")
end)
InitializedConfig()View Source
OnConfigUpdated(key, oldValue, newValue)View Source
Purpose
Runs whenever a configuration value is updated locally through `lia.config.set`, `lia.config.forceSet`, or a networked configuration update.
Category
Configuration
Realm
Shared
Parameters
string key The configuration key that changed.
any oldValue The previous value for the configuration key.
any newValue The new value for the configuration key.
Example Usage
hook.Add("OnConfigUpdated", "liaExampleOnConfigUpdated", function(key, oldValue, newValue)
print("[MyModule] handled OnConfigUpdated")
end)
VoiceToggled(enabled)View Source
Purpose
Runs when the `IsVoiceEnabled` configuration value changes.
Category
Configuration
Realm
Shared
Parameters
boolean enabled True when voice chat is enabled, false when it is disabled.
Example Usage
hook.Add("VoiceToggled", "liaExampleVoiceToggled", function(enabled)
print("[MyModule] handled VoiceToggled")
end)