Only this pageAll pages
Powered by GitBook
1 of 51

DirkScripts Documentation

Loading...

The Basics

Loading...

Resources

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Loading...

Dirk Lib

Welcome

This documentation covers everything you need to get your script set up and working as intended. Please make sure to read it carefully—most issues can be avoided by following the steps provided. If all dependencies are installed correctly and you follow the instructions, your script will work as expected.

🛠 Need Support?

If you've followed the documentation and are still having issues, head over to our Discord and open a support ticket. The link is in the sidebar (bottom left). We’ll help you out once you’ve confirmed you've run through the docs.

🧩 Custom Work & Services

Looking for something more tailored to your server? We offer:

  • ⚙️ Script optimisations and performance tweaks

  • ⚒️ Creation of scripts from idea to production.

  • 🎨 UI creation, edits, and complete redesigns

  • 🧱 Custom features or systems built to your spec

If you’re after something beyond what's available out-of-the-box, open a ticket in Discord to discuss your requirements.

Installing Resources

Here we will guide you through the basics from downloading the asset from your keymaster to where to put the folder, more specific instructions will be found on the left under resource name.

🔑 Get your asset from Keymaster

After purchasing one of our scripts, head over to keymaster.fivem.net — this is where all of your purchased assets are managed.

Once logged in, click on "Purchased Assets", then locate the script you just bought.

From there, hit Download to grab the latest version.

📂 Installation Guide

If this is your first time installing a DirkScripts resource, we recommend creating a folder named:

[dirk]

Place all DirkScripts scripts and their dependencies inside this folder. This keeps everything organised and ensures proper start order.

Example structure:

resources/
└── [dirk]/
    ├── dirk_inventory
    ├── dirk_traphouse
    └── dirk_dependencies

Add the following to your server.cfg:

The best location is somewhere after your framework and it's dependencies start.

ensure [dirk]

This approach helps avoid loading issues and makes updates easier down the line.

Getting Started

🚀 Quick Start

To get started, simply ensure dirk_lib is started after your framework, inventory, and targeting resources. There’s no complex setup—dirk_lib will automatically detect supported resources and apply the correct bridging logic for your setup.

No extra config needed—just ensure the dependencies are started before dirk_lib.


⚙️ Server Variables (Convars)

You can customize the behaviour of dirk_lib by setting server variables (ConVars). These can be placed in your server.cfg or follow the tip below for a cleaner way.

💡 Tip: - Create a file called dirk_lib.cfg this will stop your actual server.cfg getting too clogged. - Then just do exec dirk_lib.cfg somewhere in your server.cfg before dirk_lib starts.

Developers

To get started with lib, include the shared script within your resource's fxmanifest.lua

You are able to select modules to be loaded, however they will also dynamically import. This can be done via the dirk_libsmanifest option

Bridging

This is a list of all the resources that this lib will bridge for, add your own by making a PR or contacting me on discord.


# Example Start Order
ensure qb-core
ensure ox_inventory
ensure ox_target

ensure dirk_lib
# The theme below will apply to all UI created by DirkScripts utilising the lib themes. 
# Theme starts at 0 and goes to 9 
# 0 is the lightest color and 9 is the darkest
# You can set the primary color to custom and set the customTheme to your own colors
# Use this generator in order to make your own custom color palettes https://mantine.dev/colors-generator/?color=7b36b5 
# Default mantine colors can be found here https://mantine.dev/theming/colors/#default-colors
setr dirk_lib:primaryColor dirk # Set to custom to use customTheme
setr dirk_lib:primaryShade 9 # 0-9
setr dirk_lib:customTheme [
  "#e5f8ff",
  "#d0ecff",
  "#a0d7fc",
  "#6dc1fa",
  "#47aef9",
  "#32a2f9",
  "#259cfa",
  "#1888df",
  "#0179c8",
  "#0068b1"
]

setr dirk_lib:language en
setr dirk_lib:debug true
setr dirk_lib:currency $
setr dirk_lib:serverName DirkRP
setr dirk_lib:logo https://via.placeholder.com/150

# Configure the resources you want to use will autodetect otherwise [OPTIONAL]
setr dirk_lib:framework qbx_core
setr dirk_lib:inventory dirk_inventory
setr dirk_lib:itemImgPath nui://dirk_inventory/web/images/
setr dirk_lib:primaryIdentifier license
setr dirk_lib:target ox_target
setr dirk_lib:interact sleepless_interact
setr dirk_lib:time dirk_weather
setr dirk_lib:phone lb-phone

setr dirk_lib:keys dirk_keys
setr dirk_lib:garage dirk_vehicles
setr dirk_lib:fuel dirk_fuel


setr dirk_lib:ambulance dirk_ambulance
setr dirk_lib:prison dirk_prison
setr dirk_lib:dispatch dirk_dispatch


# NOTIFICATIONS
setr dirk_lib:notify dirk_lib
setr dirk_lib:notifyPosition top-right
setr dirk_lib:notifyAudio true

# Context Menu 
setr dirk_lib:contextMenu dirk_lib
setr dirk_lib:contextClickSounds true
setr dirk_lib:contextHoverSounds true

# Dialog
setr dirk_lib:dialog dirk_lib
setr dirk_lib:dialogClickSounds true
setr dirk_lib:dialogHoverSounds true

# showTextUI 
setr dirk_lib:showTextUI dirk_lib
setr dirk_lib:showTextPosition bottom-center

# progressBar 
setr dirk_lib:progress dirk_lib
setr dirk_lib:progBarPosition bottom-center

# Groups 
setr dirk_groups:maxMembers 5
setr dirk_groups:maxDistanceInvite 5
setr dirk_groups:inviteValidTime 5
setr dirk_groups:maxLogOffTime 5
shared_scripts {
  '@dirk_lib/init.lua'
}
dirk_libs {
  'math',
  'objects'
}
SUPPORTED RESOURCES

Modules

await

A small module containing a simple time based await for function callback

Shared Module - This can be used by both clients and the server

lib.await

Used to add a timed delay to the defined callback

lib.await(func, timeout)
Parameter
Type
Required
Description

func

Function

Callback function to be executed

timeout

Number

Duration in sections to wait

Client

Helpful functions for the player data structure and functions

Groups

System for creating player groups and managing them. Used in clean_pause and other clean jobs.

Server & Client Module - Follow the links below for the relervent topic

Server

Client

Server

Helpful functions for the player data structure and functions

Commands

Some useful commands

logout [QBX|QBCore ONLY]

This will make the player sit down and wait for logout, this can be adjusted under settings.basic

Configuration

All configuration will be done via the files within the settings folder.

Commands

Some useful commands that are locked to admin only by default. All of these commands will list the arguments required if you type them in the chat.

projectCar:deleteNearest

Will delete the nearest projectCar entirely from the database and the world.

projectCar:completeNearest

Will complete the nearest projectCar requiring the player to just get in and start it

projectCar:giveEngine

This will give you an engine with the correct metadata dependant on the class you supply.

projectCar:allItems

Will give you all the items you need to complete a car.

Context

Objects

Used to register and remove object spawning, from peds to vehicles.

Client Module - This can only be used on the client

lib.objects.register

Create a new object

Parameter
Type
Required
Description

lib.objects.get

Get information regarding an object

Parameter
Type
Required
Description

lib.objects.destroy

Completely remove an object

Parameter
Type
Required
Description

Data Structure

This is the data structure of an object and the valid options

Print

Simple dev tool for printing information and warnings to console

Shared Module - This can be used by both clients and the server

lib.print

Print some information to the console

The debug type can only be used in debug mode.

Parameter
Type
Required
Description

lib.addPrintType

Add a new of print to be used

Parameter
Type
Required
Description

Player

Helpful functions for the player data structure and functions

Server & Client Module - Follow the links below for the relervent topic

lib.objects.register(name, new_data)

name

String

Unique reference for object

new_data

Object

Options for the object, refer to Data Structure

local obj = lib.objects.get(name)

id

String

Unique reference for the object

lib.object.destroy(id)

id

String

Unique reference for the object

{
    type = "ped",                 -- This can be: ped, vehicle or object
    model = `a_f_m_bevhills_01`,  -- Model to be spawned, must be the model hash
    pos = vector4(0, 0, 0, 0),    -- Position of the object
                                  -- This also can be a polyzone for a set render area
    renderDist = 50,              -- When to render the object
}
lib.print(_type, ...)

-- Example
lib.print("debug", "Example print")

_type

String

Type of print - info, warn, error or debug

...

Any

Debug info

lib.addPrintType(_type, prefix, condition)

_type

String

Unique print type

prefix

String

What should be prefixed in front of the debug

condition

Function

Callback to check if it should print

Server
Client

Table

Used to request models and textures

Client Module - This can only be used on the client

lib.table.deepClone

Used to quickly copy a table, useful for global state values

local copiedTable = lib.table.deepClone(table)
Parameter
Type
Required
Description

table

ObjectArray

Table to be copied

lib.table.findKeyInTable

Check through a table for a set key

local foundData = lib.table.findKeyInTable(tbls, key)
Parameter
Type
Required
Description

tbls

StringObject

Table to be searched

key

StringNumber

Key to be found

lib.table.includes

Check if a value is present in a table

local found = lib.table.includes(table, value, recursive)
Parameter
Type
Required
Description

table

ObjectArray

Table to be searched

value

Object

Value to be found

recursive

Boolean

Check sub tables too

lib.table.convert

Convert data to different formats

local data = lib.table.convert(_type, data)
Parameter
Type
Required
Description

_type

String

Type of data - vectors, items_sql, string, item_ox, convert_idexes

data

Any

Data to be converted

lib.table.count

Count a table and sub tables

local count = lib.table.count(table)
Parameter
Type
Required
Description

table

ObjectArray

Table to be counted

Getting Started

Please follow these instructions carefully if you do so you should have no issues, if you do still experience issues after reading through all of this then please make a ticket in discord.

DEPENDENCIES

You will need the following resources installed to be able to use this script properly, please ensure this is possible before buying the script My Library dirk_lib

Converting Data from Older Version

Please grab your old projectCars.json and place it in the root directory of dirk_projectCars. The script will auto-detect it on startup and convert any old vehicles to the new SQL table.

Inventory Instructions

📤 OX_INVENTORY/DIRK_INVENTORY

In order for this to work you will need to add all the data in INSTALLATION/itemsToAdd/ox_items.lua to ox_inventory/data/items.lua

['windscreen'] = {
  ['weight'] = 1000,
  ['label'] = 'Windscreen',
},

❓QB-INVENTORY

For all QB based inventory systems you can find the items in the following folder

INSTALLATION/itemsToAdd/qb_items.lua should you wish to manually add them

['windscreen'] = {
  ['description'] = 'Vehicle Part',
  ['useable'] = true,
  ['weight'] = 1000,
  ['shouldClose'] = false,
  ['type'] = 'item',
  ['label'] = 'Windscreen',
  ['unique'] = false,
  ['name'] = 'windscreen',

},

UI

Request

Used to request models and textures

Client Module - This can only be used on the client

lib.request.model

Load a model with timeout checks

local success = lib.request.model(model, timeout)
Parameter
Type
Required
Description

model

StringObject

Model(s) to load

timeout

Number

Timeout for the model loads, default 20s

lib.request.streamedTextureDict

Request texture dictionary

local success = lib.request.streamedTextureDict(txd, timeout)
Parameter
Type
Required
Description

txd

StringObject

Texture(s) to load

timeout

Number

Timeout for the texture loads, default 20s

Client

Helpful functions for the player data structure and functions

Untitled

Project Cars

Drug Labs v2

Exports

setCharacterState

This will set the character state to one of the ones you have defined within settings/extras/characterStates

blip

Used for GTA map location blips, for example a fuel station location

Client Module - This can only be used on the client

lib.blip.register

Register a new blip to be shown on the map

lib.blip.register(id, data)
Parameter
Type
Required
Description

id

String

Unique reference for the blip

data

Object

Options for the blip, see

lib.blip.get

Get a blip's data via it's id

local blip = lib.blip.get(id)
Parameter
Type
Required
Description

id

String

Unique reference for the blip

lib.blip.delete

Remove a blip from the map and cache

lib.blip.delete(id)
Parameter
Type
Required
Description

id

String

Unique reference for the blip

Data Structure

This is the data structure of a blip and the valid options

{
    -- Required
    pos = vector2(150.0, 100.0),    -- Used as the location on the map
    name = "Example Blip",          -- Label displayed on the map key
    sprite = 1,                     -- Sprite to be displayed
    display = 4,                    -- Display options
    scale = 1.0,                    -- Size of the blip
    color = 1,                      -- Color of the blip
    -- Not Required
    shortRange = false,             -- Is the blip short range
    category = 1,                   -- Category of the blip
    alpha = 255,                    -- Alpha (opacity) of the blip
    rotation = 0,                   -- Rotation
    route = false,                  -- Should the blip be routed to
    canSee = function()             -- Should the blip render
        return true
    end,                  
}

Useful Links

FiveM Blip Sprites Reference: https://docs.fivem.net/docs/game-references/blips/#blips

FiveM Native SetBlipDisplay Reference: https://docs.fivem.net/natives/?_0x9029B2F3DA924928

Fivem Blip Colour Reference: https://docs.fivem.net/docs/game-references/blips/#blip-colors

FiveM Native SetBlipCategory Reference: https://docs.fivem.net/natives/?_0x234CDD44D996FD9A

Getting Started

For the supported clothingSystems/Frameworks this will be drag and drop for most users, with no effect to players characters etc.

DEPENDENCIES

You will need the following resources installed to be able to use this script properly, please ensure this is possible before buying the script My Library

Supported Frameworks
Supported Clothing System
  • QB-CLOTHING

  • ILLENIUM_APPEARANCE

  • FIVEM-APPEARANCE

  • DIRK_CHARCREATOR

1

Install

Make sure you have installed and it's autodetecting the correct resources, see server console.

2

Script Placement

Place the script folder somewhere within your resources folder, ensuring it is starting after your framework and after dirk_lib.

3

Start Order

Please ensure you have this starting both after your framework and the dirk_lib.

4

Success

Congratulations you have now installed dirk_multichar please login and check it out.

Data Structure
dirk_lib
QBX_CORE
ES_EXTENDED
QB-CORE
dirk_lib
dirk_lib

Cache

The cache is used to store frequent information that scripts will use, this reduces the load of scripts overall as the core library is the only resource gathering these variables.

Usage

The cache is simple to access, once you've followed the Getting Started steps, you will be able to access the following values:

Cache Types

Name
Description

ped

The players ped id

vehicle

Current vehicle entityId if there is one or false

driver

true or false for if the player is driving

seat

The seat the player is in if any

weapon

The weapon the player is holding if any

dead

Is the player dead, this is based off of framework specific death metadata and IsEntityDead()

cuffed

Again this is framework specific.

job

This is in the format of dirk_lib/types/job

playerId

The players PlayerId()

citizenId

The players unique character identifier if they have one

serverId

The players serverId

playerLoaded

Whether or not the player has loaded and selected a character

Accessing

You can simple called cache.x with whichever type you wish anywhere in your code, so long as dirk_lib is imported.

lib.onCache

All of the above cache types can be used with lib.onCache, this is essentially a listener that will trigger upon change of the value and at initial set.

  -- We can replace 'cuffed' with any of the values from above.
  lib.onCache('cuffed', function(isCuffed, oldValue)
    print(('Player is now cuffed: %s\nPlayer was cuffed before: %s'):format(isCuffed, oldValue))
  end)
  -- OR IF YOU REALLY WANTED--
  AddEventHandler("dirk_lib:cache:cuffed", function(isCuffed, oldValue)
    print(('Player is now cuffed: %s\nPlayer was cuffed before: %s'):format(isCuffed, oldValue))
  end)

Types

Installation

Follow this guide to install the resource.

Dependencies

  • dirk_lib (REQUIRED)

Lab Shells (YOU DO NOT NEED THESE HOWEVER YOU WILL HAVE TO RECONFIGURE SHOULD YOU CHOOSE NOT TO USE THEM)

https://www.k4mb1maps.com/package/4698329 https://www.k4mb1maps.com/package/4672285

Items

There is a folder within the script called 'install' within that is another folder called 'itemsToAdd' please choose the format you require for your framework/inventory

Types

Creating Labs

Multicharacter

Category

These are all the properties available per category for your store, you can disable categories for a store by removing the categories table entirely.

Field
Optional
Type
Description

id

string

Unique identifier for the store.

type

'buy'

Tool Item

Each tool is defined as a key in the tools table with a structured value. Here's a breakdown of the expected fields:

📄 Fields:

Field
Type
Required
Description

label

string

✅

Display name of the item.

weight

integer

✅

Weight in grams (e.g. 1000 = 1kg).

description

string

✅

Description text shown in item UI.

chanceOfBreak

integer

❌

Percent chance (0–100) the tool breaks on use.

holdRotation

vector3

❌

Adjusts the rotation of the held object.

holdOffset

vector3

❌

Adjusts the position offset when held.

model

string

❌

Model name of the object to hold (e.g. "prop_tool_box_04").

useable

function

❌

Function to execute when the item is used.

strength

integer

❌

Max supported vehicle weight (in grams). Limits what vehicles this item works on.


💡 Example

tools = {
    wrench = {
        label         = "Wrench",
        weight        = 1000,
        description   = "A sturdy wrench for basic repairs.",
        chanceOfBreak = 25, -- 25% chance of breaking
        holdRotation  = vector3(90.0, 0.0, 0.0),
        holdOffset    = vector3(0.0, -0.15, -0.02),
        model         = "prop_tool_wrench",
        strength      = 2000,
        useable       = function(src)
            -- custom usage logic here
        end
    }
}

Target

Used to create target zones (Third Eye)

Client Module - This can only be used on the client For zone data structures, refer to your target resource

lib.target.box

Create a simple box zone

lib.target.box(id, data)
Parameter
Type
Required
Description

id

String

Unique zone reference

data

Object

Zone options

lib.target.polyzone

Create a polrzone

This documentation isn't confirmed / is not implimented yet

lib.target.polyzone(id, data)
Parameter
Type
Required
Description

id

String

Unique zone reference

data

Object

Zone options

lib.target.removeZone

Remove a created zone

lib.target.removeZone(id)
Parameter
Type
Required
Description

id

String

Unique zone reference

lib.target.entity

Create an entity and allow targeting

lib.target.entity(entity, data)
Parameter
Type
Required
Description

entity

String

Unique zone reference

data

Object

Zone options

lib.target.removeEntity

Remove an entity zone

lib.target.removeEntity(entity, net)
Parameter
Type
Required
Description

id

String

Unique zone reference

net

Object

Is the entity networked

Stores

A free, simple, and flexible store system for FiveM, styled natively and designed to be themed easily to fit your server’s aesthetic.

Features

  • Default Stores Has most if not all of the default stores configured with basic items from major inventories/frameworks but is fully adjustable.

  • Categories Optionally have categories for your stores for easier navigation.

  • Metadata Generators Supports adding unique metadata to specific items, even if your inventory system doesn’t handle it natively.

  • Group/License Locking Lock the entire store or certain items to different groups or licenses within your city.

  • Payment Methods Easily add new payment methods to use in any store via the settings/paymentMethods.lua. Here you can define an add and a remove function to implement any sort of currency you wish.

  • Dynamic Store Creation Register new stores at runtime from the server, giving you complete control over when and where stores appear.

  • Theming Change the color scheme globally or per store. Don't like green? Pick something that matches your vibe. To set a new global theme for all dirk_scripts see dirk_lib convars


Server

Helpful functions for the player data structure and functions

lib.player.get

Get the player's information

Parameter
Type
Required
Description

lib.player.identifier

Returns the identifier (CitizenID) of the player

Parameter
Type
Required
Description

lib.player.name

Returns the name of the character

Parameter
Type
Required
Description

lib.player.phone_number

Return the phone number of the character

Parameter
Type
Required
Description

lib.player.gender

Return the gender of the character

Parameter
Type
Required
Description

lib.player.checkOnline

Check if a player is online by their CitizenID

Parameter
Type
Required
Description

lib.player.jail

Send a player to jail

Parameter
Type
Required
Description

lib.player.addMoney

Add money to a player

Parameter
Type
Required
Description

lib.player.removeMoney

Remove money to a player

Parameter
Type
Required
Description

lib.player.addItem

Add item to a player

Parameter
Type
Required
Description

lib.player.removeItem

Remove an item for a player

Parameter
Type
Required
Description

lib.player.editItem

Edit the metadata of an item

Parameter
Type
Required
Description

lib.player.getInventory

Returns the inventory of the player

Example Return:

Parameter
Type
Required
Description

Zones

Used to create and manage polyzones

Client Module - This can only be used on the client

lib.zones.register

Create a new zone

Parameter
Type
Required
Description

Zone Examples

lib.zones.get

Get zone information

Parameter
Type
Required
Description

lib.zones.delete

Remove a created zone

Parameter
Type
Required
Description

lib.zones.isInsideZone

Check whether a position lies inside a zone(s)

Parameter
Type
Required
Description

Data Structure

This is the data structure of a blip and the valid options

Some zones have different requirements, see below:

Game Zones:

Getting Started

DEPENDENCIES

You will need the following resources installed to be able to use this script properly. My Library

Supported Frameworks
1

Install

Make sure you have installed and it's autodetecting the correct resources, see server console.

2

Script Placement

Place the script folder somewhere within your resources folder, ensuring it is starting after your framework and after dirk_lib.

3

Start Order

Please ensure you have this starting both after your framework and the dirk_lib.

4

Success

Congratulations you have now installed dirk_stores please login and check it out.

local player = lib.player.get(source)

src

Number

Source of the target

local citizenid = lib.player.identifier(src)

src

Number

Source of the target

local firstName, lastName = lib.player.name(src)

src

Number

Source of the target

local phoneNumber = lib.player.phone_number(src)

src

Number

Source of the target

local gender = lib.player.gender(src)

src

Number

Source of the target

local isOnline = lib.player.checkOnline(identifier)

identifier

String

Identifier to be checked for

lib.player.jail(trg, data)

trg

Number

Source to be targeted

data

Object

Data to be used, for example time

lib.player.addMoney(src, acc, amount, reason)

src

Number

Source to be targeted

acc

String

Account to be deposited in

amount

Number

Amount to be moved

reason

String

Transaction reason

lib.player.removeMoney(src, acc, amount, reason)

src

Number

Source to be targeted

acc

String

Account to be removed

amount

Number

Amount to be moved

reason

String

Transaction reason

lib.player.addItem(src, item, amount, md, slot)

src

Number

Source to be targeted

item

String

Item spawncode

amount

Number

Quantity

md

Object

Metadata for the item

slot

Number

Slot to be placed in, default is next available

lib.player.removeItem(src, item, amount, md, slot)

src

Number

Source to be targeted

item

String

Item spawncode

amount

Number

Quantity

md

Object

Metadata for the item

slot

Number

Slot to be placed in, default is next available

lib.player.editItem(src, slot, new_data)

src

Number

Source to be targeted

slot

Number

Item slot to be targeted

new_data

Object

Data to be set

local inventory = lib.player.getInventory(src)
{
    {
        name = "example",
        label = "Example Item",
        count = 10,
        info = {
            metadata = true,
        },
        slot = 1
    }
}

src

Number

Source to be targeted

dirk_lib
QBX_CORE
ES_EXTENDED
QB-CORE
dirk_lib
dirk_lib

Part Item

Each part is defined as an entry in your parts table with configurable fields for how it behaves during installation, usage, and interaction with vehicles.

📄 Fields:

Field
Type
Required
Description

label

string

✅

The display name of the part.

searchChance

number

✅

Chance this item is found in a search. Set to 0 to make it unsearchable. Think of it like names in a hat—more entries = higher odds.

weight

number

✅

Weight of the part in the inventory (e.g., 1000 = 1kg).

tools

table

❌

Tools required to fit this part. Format: { itemName = quantity }.

consumables

table

❌

Items that will be consumed when installing this part. Same format as tools.

anim

table

❌

Animation config when applying the part.

→ dict

string

⚠️

Animation dictionary. Must specify either dict or scenario.

→ clip

string

✅

Animation clip name.

→ flag

number

❌

Optional animation flags.

→ time

number

❌

Time in seconds to complete the install animation.

reqParts

array

❌

Names of other parts required before this one can be installed.

model

string

❌

Prop model name shown in hand or placed during install (e.g. "prop_oilcan_01a").

applyRange

number

❌

Max distance from the vehicle to allow this part to be installed.

applyAtBone

string

❌

The bone name where this part applies (e.g., "engine").

canStart

function

❌

Function run to check if the car can start based on this part. Parameters:<br/>→ itemExists: boolean (is part installed?)<br/>→ _type: string (part name)<br/>Should return: boolean, message.

removePart

function

❌

Function triggered when removing the part. Parameters:<br/>→ self: vehicle object<br/>→ entity: number (vehicle entity ID)<br/>→ _type: string (part name).

addPart

function

❌

Function triggered when adding the part. Same parameters as removePart.


💡 Example

luaCopyEditparts = {
    oil_filter = {
        label        = "Oil Filter",
        searchChance = 15,
        weight       = 250,
        tools        = { wrench = 1 },
        consumables  = { oil = 1 },
        anim         = {
            dict  = "anim@amb@clubhouse@tutorial@bkr_tut_ig3@",
            clip  = "machinic_loop_mechandplayer",
            flag  = 16,
            time  = 5
        },
        reqParts     = { "engine_cover" },
        model        = "prop_oilcan_01a",
        applyRange   = 2.0,
        applyAtBone  = "engine",
        canStart     = function(installed, part)
            return installed, installed and "" or "Engine won't start without oil filter."
        end,
        removePart   = function(self, entity, part)
            -- custom logic to clean up or detach
        end,
        addPart      = function(self, entity, part)
            -- apply tuning or set vars
        end
    }
}
lib.zones.register(id, data)

name

String

Unique zone reference

data

Object

Zone options, refer to Data Structure

local polyPoints = {
    vector2(0, 0),
    vector2(10, 10),
    vector2(20, 20),
    vector2(0, 30),
    vector2(-10, 15),
}

lib.zone.register("exampleZone", {
    type = "poly",
    pos = polyPoints,
    onEnter = function(data)
        lib.print("debug", "Entered Zone")
    end,
    onExit = function(data)
        lib.print("debug", "Exited Zone")
    end,
})
lib.zone.register("exampleZone", {
    type = "box",
    pos = vector4(0, 0, 0, 0),
    size = vector3(0, 0, 0),
    onEnter = function(data)
        lib.print("debug", "Entered Zone")
    end,
    onExit = function(data)
        lib.print("debug", "Exited Zone")
    end,
})
lib.zone.register("exampleZone", {
    type = "game_zone",
    gameZone = "ALTA"
    onEnter = function(data)
        lib.print("debug", "Entered Zone")
    end,
    onExit = function(data)
        lib.print("debug", "Exited Zone")
    end,
})
local zone = lib.zones.get(name)

name

String

Unique zone reference

lib.zones.delete(name)

name

String

Unique zone reference

local isInside, zoneName = lib.zones.isInsideZone(name, pos)

name

StringObject

Unique zone reference(s)

pos

Vector3

Position to be checked

{
    -- Required
    type = "circle",            -- Type of zone: circle, circle2D, poly, box, game_zone                 
    -- Not Required
    onEnter = function(data)
        -- Callback for entering the zone
    end,
    onExit = function(data)
        -- Callback for exiting the zone
    end,
}
{
    pos = vector3(0, 0, 0),   -- Position of the zone
    radius = 5.0,             -- Size of the zone radially from the point
}
{
    pos = vector2(0, 0),      -- Position of the zone
    radius = 5.0,             -- Size of the zone radially from the point
}
{
    points = {                -- Boundy marks for the polyzone
        vector2(0, 0),
        vector2(2, 1),
        vector2(3, 3),
    }
}
{
    pos = vector4(0,0,0,0),      -- Position of the zone, x, y, z, heading
    size = vector3(0,0,0)        -- Size of the zone from the center point
}
{
    gameZone = "ALTA"
}
https://docs.fivem.net/natives/?_0xCD90657D4C30E1CA

interact

Used to register and control any player interaction

Client Module - This can only be used on the client

lib.interact.register

Create a new player interaction

lib.interact.register(name, data)
Parameter
Type
Required
Description

name

String

Unique reference for the interaction

data

Object

Options for the interact, refer to

lib.interact.get

Get information regarding an interaction

local interaction = lib.interact.get(name)
Parameter
Type
Required
Description

name

String

Unique reference for the interaction

lib.interact.destroy

Completely remove an interaction

lib.interact.destroy(name)
Parameter
Type
Required
Description

name

String

Unique reference for the interaction

Data Structure

This is the data structure of an interaction and the valid options

There are multiple different interactions seen below:

Circle

{
    zone_type = "circle",
    pos = vector4(10, 10, 20, 10),
    radius = 10
}

Poly

{
    zone_type = "poly",
    polygon = {
        vector3(0, 0, 0),
        vector3(0, 0, 0),
        vector3(0, 0, 0),
    },
}

Box

{
    zone_type = "box",
    pos = vector4(10, 10, 20, 10),
    size = vector3(1, 1, 1)
}

Marker

{
    zone_type = "marker",
    pos = vector4(10, 10, 20, 10),
    color = vector4(255, 255, 255, 255),            -- RGBA
    scale = vector3(1, 1, 1),
    -- Not Required
    dir = vector3(0, 0, 0),
    rot = vector3(0, 0, 0),
    bob = false,
    face = false,
    txd = false,
    txn = false,
    drawEnts = false
}

Text

This documentation is pending confirmation

{
    zone_type = "text",
    text = "Hello World"
    pos = vector4(10, 10, 20, 10),
    size = vector3(1, 1, 1)
}
Data Structure

Store

This defines the structure for creating a store, either via your config or dynamically through an export. Stores support job/role restrictions, time-based spawning, custom themes, and more.

📄 Fields:

Field
Type
Required
Description

id

string

✅

Unique identifier for the store.

type

'buy' or 'sell'

✅

Determines whether the store is for buying or selling.

name

string

✅

Store display name (e.g. "24/7 Store").

description

string

✅

Short UI description shown at the top of the store interface.

icon

string (FontAwesomeIcon)

✅

Icon shown in the UI (FontAwesome class name).

modelType

'ped' | 'vehicle' | 'object'

❌

Type of entity used to spawn the store.

models

string[]

✅

Array of model names (e.g. "s_m_m_storeclerk_01").

locations

vector4[]

✅

Array of spawn locations with heading.

paymentMethods

string[]

✅

IDs referencing valid payment methods.

categories

category[]

❌

List of item categories shown in the UI.

stock

stockItem[]

✅

Inventory for the store.

openingHours

[number, number]

❌

Time range when store is available (e.g. {6, 22} for 6AM–10PM).

groups

string | string[] | Record<string, number>

❌

Job, gang, or grade restrictions.

licenses

string | string[]

❌

Player must have these licenses to access the store.

discordRoles

string | string[]

❌

Discord roles required to open the store.

canOpen

function(src: number)

❌

Server-side function to determine if the player can open the store.

theme

themeObject

❌

Optional override for this store’s visual theme.

onExchange

function(src, items, totalPrice)

❌

Called on attempted transaction. Return false to cancel. Return a second param as reason.


💡 Example

BaseStores = BaseStores or {}
BaseStore.gunshop = {
    id          = "gunshop",
    type        = "buy",
    name        = "Ammu-Nation",
    description = "Everything you need to stay protected.",
    icon        = "fa-solid fa-gun",
    modelType   = "ped",
    models      = { "s_m_m_ammucountry" },
    locations   = {
        vec4(17.8, -1108.6, 29.8, 160.0)
    },
    paymentMethods = { "cash", "bank" },
    categories  = { 
        {
            
        }
    },
    stock       = {
        { item = "pistol", price = 2500 },
        { item = "pistol_ammo", price = 100 }
    },
    openingHours = { 9, 21 },
    groups       = { police = 0, sheriff = 0 },
    licenses     = { "weapon_license" },
    canOpen      = function(src)
        return true
    end,
    onExchange   = function(src, items, price)
        if price > 10000 then
            return false, "Transaction limit exceeded"
        end
        return true
    end
}

Exports

Server

registerStore

Dynamically creates a store at runtime, syncing to all clients for use straight away, when the resource that creates it is stopped the store will be deleted and unregistered from all clients. The storeData parameter is based upon the StoreProps.

Example

This will spawn a very basic shop with a store clerk at the coordinates listed.

local storeData = {
    id = 'myNewTestStore', 
    type = 'buy', 
    name = 'My Test Store', 
    description = 'My Short Test Description', 
    icon        = 'fas fa-store', 
    modelType   = 'ped', 
    models      = {'mp_m_shopkeep_01'}, 
    locations   = {
        vector4(0,0,0,0),
    },
    paymentMethods = {'cash', 'bank'}, 
    stock = {
        {
          name = 'bread',  
          price = 100, 
        }
    },
}

exports.dirk_stores:registerStore(storeData)

lib.zone.register("exampleZone", {
    type = "circle",
    pos = vector3(0, 0, 0),
    radius = 5.0,
    onEnter = function(data)
        lib.print("debug", "Entered Zone")
    end,
    onExit = function(data)
        lib.print("debug", "Exited Zone")
    end,
})
lib.zone.register("exampleZone", {
    type = "circle2D",
    pos = vector2(0, 0),
    radius = 5.0,
    onEnter = function(data)
        lib.print("debug", "Entered Zone")
    end,
    onExit = function(data)
        lib.print("debug", "Exited Zone")
    end,
})

Stock

All the properties of a stock item within your stock table for a store.

Field
Optional
Type
Description

id

string

Unique identifier for the store.

type

'buy'

Tebex Integration

You can allow players to purchase labs via tebex instead of in-game for some labs should you wish players can join the server after purchase and use the Config.RedeemCommand (/ClaimLab) in order to claim their new lab this will give them keys into their inventory and ownership.

First you will need to ensure you have linked your tebex to your FiveM server there are many guides for this on Google. You will then need to make a new package with the deliverable product being a Game Server command setup like so: The name of this package you create must be the name of the index of the lab in the config. So in the example below it would have to be "Downtown Cocaine Lab"

Example of Tebex Lab in Config
    ['Downtown Cocaine Lab'] = { --## Private Owned
      Door  = vector4(184.57171630859,-1514.0261230469,29.318643569946,225.4059753418), 
      Shell = "Cocaine High End Shell", -- Can be false or can be model name of a shell


      TebexPackage = 'https://www.dirkscripts.com/category/resources', --## This will not be useable until claimed. Please read the documentation provided on how to setup tebex packages. --- Access.Ownable must be a number but it doesnt matter which number it is if this is a tebex package you can set this to the link to the package see docs

      TeamWorkMode = false, --## If this is true required items will come from the shared stockpile and reward items will also go here
      KeyItem      = nil, --## This could be a name of an item if you wanted a different item to be the key for this lab :thinking: It'll still need metadata attached via the script
      
      Access = {
        Ownable = 50000, --## Will make this buyable and have key access -- Probably leave Gangs, Jobs and Public as false. Can be false also
        KeyCode = false, --## Do you want a keycode to access this? -- This will overwrite everything else
        Public  = false, 
        Gangs   = false, --## Gangs can access this lab
        Jobs    = false, --## Gangs can access this lab
      },


      IngOrders = {
        Price        = 5000, 
        DropPoint    = vector4(171.79383850098,-1517.9276123047,29.141628265381,135.28630065918), 
        Items = {
          rawcocaine   = 50, 
          bakingsoda   = 50, 
          actionfigure = 25,  
        },
      },

      Blip = { --## Delete this blip table if you don't want a blip
        Scale   = 0.75, 
        Sprite  = 497, 
        Color   = 45,
        Display = 4,
        Close  = true, --## Will only show this on the minimap when you are close to the lab forcing players to drive around and try find it. 
      },

      Stages = {
        [1] = {
          Position      = vector4(4.825562, -3.003174, -2.673802, 179.7306060791),
          Label         = "Cut Cocaine",
          Icon          = "fa-solid fa-scissors",
          
          FancyScene    = "Cut Cocaine", --# This can be one of the scenes from Config.Scenes or it can be false and you can use a regular animation
          NormalAnim    = false, --## Can be false or can be a table like so {anim = "anim_b", dict = "dict_a", time = 15000}
          RequiredItems = {
            rawcocaine = 3, 
            bakingsoda = 2, 
          },
          RewardItems   = {
            cutcocaine = 2, 
          },
        },
        [2] = {
          Position      = vector4(3.890869, -0.5727539, -2.673793,359.83615112305),
          Label         = "Cut Cocaine",
          Icon          = "fa-solid fa-scissors",
          
          FancyScene    = "Cut Cocaine", --# This can be one of the scenes from Config.Scenes or it can be false and you can use a regular animation
          NormalAnim    = false, --## Can be false or can be a table like so {anim = "anim_b", dict = "dict_a", time = 15000}
          RequiredItems = {
            rawcocaine = 3, 
            bakingsoda = 2, 
          },
          RewardItems   = {
            cutcocaine = 2, 
          },
        },
        [3] = {
          Position      = vector4(4.125854, 3.231079, -2.673817,0.0),
          Label         = "Package Cocaine",
          Icon          = "fa-solid fa-box-archive",
          
          FancyScene    = "Package Cocaine", --# This can be one of the scenes from Config.Scenes or it can be false and you can use a regular animation
          NormalAnim    = false, --## Can be false or can be a table like so {anim = "anim_b", dict = "dict_a", time = 15000}
          RequiredItems = {
            cutcocaine   = 1, 
            actionfigure = 1, 
          },
          RewardItems   = {
            cocainepackage = 1, 
          },
        },
      },
    },

Changelog

  • Fixed issue with qbx_core not picking up license2 natively, resulting in no characters being shown.

  • Consolidated and reworked all logic for clothing/appearance menus to dirk_lib for simpler adding of more.

  • With illenium and all major clothing including rcore_clothing the characters will now properly display.

  • Added ability to use existing character_slots table from es_extended for vipSlots

  • Added better support for finding player cars/houses including for qs-housing.

  • Added ability to disable deleting of characters.

  • Fixed loadEvent stuff from preventing peoples HUDs showing up.

Changelog

  • Added group/license/discordRole support for both the entire store or per individual product.

  • Fixed the scrolling issue. BurningLight127

  • Payment Methods

    • Added 'black_money' as a payment method instead of placeholder 'crypto'

  • Added documentation for this script, feel free to let me know if anything is missing.

  • Add metadata field to stock instead of having to use metadataGenerators.lua.

callback

Use to easily communicate between both client and server

Shared - These functions can be used server and client however take note of the direction of callbacks and regration. Client & Server are able to callback between however you are unable to callback between clients.

lib.callback.await

the playerId is only present on the server side, it is not required for the client side.

Call and await for a response of a server callback

-- Client
lib.callback.await(event, ...)
-- Server
lib.callback.await(event, playerId, ...)
Parameter
Type
Required
Description

event

String

Server defined event name

playerId

Number

Server Only - source to send request to

cb

Function

Callback function, there must be at least one defined

lib.callback.register

Register a client callback, this can be used to easily request data from a client from the server

lib.callback.register(event, cb)
Parameter
Type
Required
Description

event

String

Event name to be called from the server

cb

Function

Callback function, should return values for the callback