🎮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