Introduction to cLib
cLib is a comprehensive utility library designed to simplify Garry's Mod addon development. It provides a robust foundation for building professional addons.
Features
| Feature | Description |
|---|---|
| VGUI Components | 20+ styled, reusable UI elements |
| MySQL Integration | Easy database connectivity with MySQLOO |
| Networking | Simplified net messages with auto-compression |
| Asset Management | Centralized colors, fonts, and materials |
| Debug Tools | Logging with file output |
| Animation System | Smooth animations with 15+ easing functions |
| i18n Support | Multi-language support for addons |
Version
Current version: 1.3
Requirements
- Garry's Mod (latest stable)
- MySQLOO 9.8 Beta (optional, for database features)
Quick Start
-- Wait for cLib to load.
hook.Add("cLib.OnLoaded", "MyAddon.Init", function()
print("cLib is ready!")
-- Register colors
cLib.AddColor("MyAddon.Primary", Color(100, 150, 200))
-- Create fonts (client-side)
if CLIENT then
cLib.CreateFont("MyAddon.Title", "Roboto", 0.03)
end
-- Register network strings (server-side)
if SERVER then
cLib.Net.SetPrefix("MyAddon.")
cLib.Net.Register("SyncData")
end
end)File Naming Convention
cLib uses file prefixes to determine where code runs:
| Prefix | Runs On | Example |
|---|---|---|
sh_ | Client & Server | sh_config.lua |
sv_ | Server Only | sv_database.lua |
cl_ | Client Only | cl_menu.lua |