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.
- FiveM server (cerulean)
- es_extended
- oxmysql
- ox_lib
- myEmergency by myScripts
- Copy the
Lawbooksfolder into yourresourcesdirectory. - Add the following line to your
server.cfg:start lawbooks - Start or restart the server.
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})"- On server start, NPCs spawn at the locations defined in
Config.Locations. - Approach an NPC and press E to open the law book UI.
- In the UI, expand each book and search by paragraph, title, content, penalty, or last updated date.
- Click the red X in the top right to close the UI.
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.
- Create law books even without MDT
- Search across all law books
Made with ❤ by MG-Scripts
Created by MG-Scripts