๐ŸŽฎ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:

  1. Download from GitHub

  2. Add the folder to your resources directory of your FXServer

  3. Ensure jd-library in your server.cfg before other resources that use it:

    ensure jd-library
    ensure your-script-name
  4. Add "@jd-library/init.lua" to client_scripts or server_scripts in the fxmanifest.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