Skip to content

GhostikGER/lawbooks

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Lawbooks

Description

Lawbooks is a simple FiveM resource that displays your “law books” in-game via a responsive HTML/JavaScript/CSS UI. All data is read from two MySQL tables managed by the myEmergency asset (by myScripts). Without myEmergency, no tables exist, so you’d have to create and populate them yourself.

Requirements

  • FiveM server (cerulean)
  • es_extended
  • oxmysql
  • ox_lib
  • myEmergency by myScripts

Installation

  1. Copy the Lawbooks folder into your resources directory.
  2. Add the following line to your server.cfg:
    start lawbooks
    
  3. Start or restart the server.

Configuration

All settings are in config.lua:

Config = {}

-- Header in UI (top center)
Config.Header = "Lawbook"

-- Database tables and sorting settings
Config.Tables = {
  law_books = {
    name         = "myemergency_law_books",      -- Table name
    order        = "id",                         -- Column to sort by
    sorting_type = "ASC"                         -- ASC or DESC
  },
  law_book_laws = {
    name         = "myemergency_law_book_laws",  -- Table name
    order        = "paragraph",                  -- Column to sort by
    sorting_type = "ASC"                         -- ASC or DESC
  }
}

-- NPC locations and blip settings
Config.Locations = {
  {
    coords   = { x=440.98, y=-978.79, z=30.69, h=179.55 },
    pedModel = "a_m_m_business_01",
    blip     = {
      enabled = true, sprite = 77, scale = 0.8, color = 3,
      name    = "Lawbook"
    }
  },
  {
    coords   = { x=117.06, y=-747.30, z=45.75, h=115.18 },
    pedModel = "a_m_m_business_01",
    blip     = {
      enabled = true, sprite = 77, scale = 0.8, color = 3,
      name    = "Lawbook"
    }
  },
}

-- Title template for each law book
Config.LawBookName = "{bookID} – {bookName} ({bookShortName})"

Usage

  1. On server start, NPCs spawn at the locations defined in Config.Locations.
  2. Approach an NPC and press E to open the law book UI.
  3. In the UI, expand each book and search by paragraph, title, content, penalty, or last updated date.
  4. Click the red X in the top right to close the UI.

Database

The myemergency_law_books and myemergency_law_book_laws tables are created and populated by the myEmergency asset.

  • myemergency_law_books: columns id, name, short_name, …
  • myemergency_law_book_laws: columns lawbook_id, paragraph, crime, others, minimum_penalty, detention_time, changeddate, …

Without myEmergency, you must create and populate these tables yourself.

Future Plans

  • Create law books even without MDT
  • Search across all law books

Made with ❤ by MG-Scripts
Created by MG-Scripts

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors