๐ฎFiveM Lua Lib
A comprehensive Lua library for FiveM development that provides utilities, helpers, and common patterns to streamline server and client-side scripting.
๐ค What is FiveM Lua Lib?
FiveM Lua Lib is a collection of reusable Lua functions, classes, and utilities designed specifically for FiveM development. It aims to reduce boilerplate code and provide common functionality that developers frequently need whe`n building FiveM resources.
๐ฏ Purpose
โก Simplify Development: Reduce repetitive code and provide ready-to-use functions
๐ Standardize Patterns: Establish consistent coding patterns across your FiveM projects
๐ง Improve Maintainability: Well-tested utilities that you can rely on
๐ Speed Up Development: Focus on your game logic instead of reinventing common functionality
โจ Key Features
๐ฅ Player Management: Utilities for handling player data, permissions, and interactions
๐ Vehicle System: Helpers for vehicle spawning, management, and customization
๐ก Event System: Simplified event handling and communication
๐ ๏ธ Utility Functions: String manipulation, math helpers, and other common utilities
๐๏ธ Class System: Object-oriented programming support for complex systems
๐ Installation
The jd-library is now its own script. Here's how to install it:
Download from GitHub
Add the folder to your
resources
directory of your FXServerEnsure
jd-library
in yourserver.cfg
before other resources that use it:ensure jd-library ensure your-script-name
Add
"@jd-library/init.lua"
toclient_scripts
orserver_scripts
in thefxmanifest.lua
file of any script that uses jd-library:-- For client usage client_script '@jd-library/init.lua' -- For server usage server_script "@jd-library/init.lua"
๐ Quick Start
Once installed, you can use the library in your scripts:
-- Events
events:on('playerSpawned', function()
print('Player spawned!')
end)
-- Players
players:setHp(200)
players:tp({x = 100, y = 200, z = 30})
-- Vehicles
local vehicle = vehicles:spawn('adder', players:pos())
-- Utils
utils:print('Health: {1}', players:hp())
Created by @jax.danger
Last updated