Only this pageAll pages
Powered by GitBook
1 of 44

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...

Welcome

Documentation

Please read the documentation clearly to prevent asking for help for an issue that is explained here. If you follow the steps on these pages your script will work providing you have all dependencies.

Further Support

If for example you still cannot use your script after following all the instructions listed here please make a ticket in our discord. You will find the discord to the left at the bottom.

Installing Resources

Keymaster

After purchasing one of our scripts you will need to head over to keymaster.fivem.net this is where all of your purchased products go. You will see this page after you login. Select the following option:

Then you can select download for the item you just purchased.

Installation

First you will want to go to the readme.md file within the resource itself and make sure there are no specific instructions for this resource. Otherwise just check the dependency list in the readme make sure you have everything installed. Then simply drag your resource into your resources folder and ensure it in your server.cfg.

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

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

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

lib.objects.register(name, new_data)
Parameter
Type
Required
Description

name

String

Unique reference for object

new_data

Object

Options for the object, refer to

lib.objects.get

Get information regarding an object

local obj = lib.objects.get(name)
Parameter
Type
Required
Description

id

String

Unique reference for the object

lib.objects.destroy

Completely remove an object

lib.object.destroy(id)
Parameter
Type
Required
Description

id

String

Unique reference for the object

Data Structure

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

{
    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
}
Data Structure

Untitled

Drug Labs v2

Exports

setCharacterState

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

Camera

Helpful camera tools for controlling the GTA camera system

Client Module - This can only be used on the client

lib.camera.focusEntity

Quickly focus a camera towards an entity

lib.camera.focusEntity(entity, data)
Parameter
Type
Required
Description

entity

Number

Entity to focus

data

Object

Camera options, refer to

lib.camera.focusHead

Focus onto a ped's head with the camera, great for menus

lib.callback.focusHead(entity, data)
Parameter
Type
Required
Description

event

String

Entity to focus

data

Object

Camera options, refer to

lib.camera.focusPoint

Focus onto a specific position with the camera

lib.callback.focusPoint(data)
Parameter
Type
Required
Description

data

Object

Camera options, refer to

lib.camera.exit

Leave active camera

lib.callback.exit()

Data Structure

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

TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC TBC

{
    -- 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,                  
}

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

Parameter
Type
Required
Description

lib.table.findKeyInTable

Check through a table for a set key

Parameter
Type
Required
Description

lib.table.includes

Check if a value is present in a table

Parameter
Type
Required
Description

lib.table.convert

Convert data to different formats

Parameter
Type
Required
Description

lib.table.count

Count a table and sub tables

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

table

ObjectArray

Table to be copied

local foundData = lib.table.findKeyInTable(tbls, key)

tbls

StringObject

Table to be searched

key

StringNumber

Key to be found

local found = lib.table.includes(table, value, recursive)

table

ObjectArray

Table to be searched

value

Object

Value to be found

recursive

Boolean

Check sub tables too

local data = lib.table.convert(_type, data)

_type

String

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

data

Any

Data to be converted

local count = lib.table.count(table)

table

ObjectArray

Table to be counted

Data Structure
Data Structure
Data Structure

Context

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

Project Cars

Client

Helpful functions for the player data structure and functions

F.A.Q

Please refer to this before asking for support in Discord to prevent wait times


Server

Helpful functions for the player data structure and functions

Creating Labs

Configuration

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

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

Client

Helpful functions for the player data structure and functions

Multicharacter

File

Simple file loading and saving helpers

Server Module - This can only be used on the server

This module only supports JSON formats

lib.file.load

Load a file and it's content

Parameter
Type
Required
Description

lib.file.save

Save a file and it's contents

Parameter
Type
Required
Description

Installation

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.

Player

Helpful functions for the player data structure and functions

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

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

local file = lib.file.load(path, from_central)

path

String

Path of the file

from_central

Boolean

If the directory should prefix saved_data

lib.file.save(path, data, from_central)

path

String

Path of the file

data

Object

Data to be saved

from_central

Boolean

If the directory should prefix saved_data

dirk_lib
QBX_CORE
ES_EXTENDED
QB-CORE
dirk_lib
dirk_lib
Server
Client
Server
Client

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.

lib.print(_type, ...)

-- Example
lib.print("debug", "Example print")
Parameter
Type
Required
Description

_type

String

Type of print - info, warn, error or debug

...

Any

Debug info

lib.addPrintType

Add a new of print to be used

lib.addPrintType(_type, prefix, condition)
Parameter
Type
Required
Description

_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

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

UI

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.

Dirk Lib

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

Parameter
Type
Required
Description

lib.interact.get

Get information regarding an interaction

Parameter
Type
Required
Description

lib.interact.destroy

Completely remove an interaction

Parameter
Type
Required
Description

Data Structure

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

There are multiple different interactions seen below:

Circle

Poly

Box

Marker

Text

This documentation is pending confirmation

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

Parameter
Type
Required
Description

lib.blip.get

Get a blip's data via it's id

Parameter
Type
Required
Description

lib.blip.delete

Remove a blip from the map and cache

Parameter
Type
Required
Description

Data Structure

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

Useful Links

FiveM Blip Sprites Reference:

FiveM Native SetBlipDisplay Reference:

Fivem Blip Colour Reference:

FiveM Native SetBlipCategory Reference:

Tools

Item Name

This is the key of tools table

type: string

Example


label:

type: string

Example

weight:

type: integer

Example

description:

type: string

Example

chanceOfBreak?:

type: integer

Example

holdRotation?:

type: vector3

Example

holdOffset?:

type: vector3

Example

model?:

Model of object to hold type: string

Example

useable?:

type: function

Example

strength?:

type: integer Used to limit the maximum weight of a vehicle that can be supported by the item.

Example

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 steps, you will be able to access the following values:

Cache Types

Name
Description

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.

lib.interact.register(name, data)

name

String

Unique reference for the interaction

data

Object

Options for the interact, refer to Data Structure

local interaction = lib.interact.get(name)

name

String

Unique reference for the interaction

lib.interact.destroy(name)

name

String

Unique reference for the interaction

{
    zone_type = "circle",
    pos = vector4(10, 10, 20, 10),
    radius = 10
}
{
    zone_type = "poly",
    polygon = {
        vector3(0, 0, 0),
        vector3(0, 0, 0),
        vector3(0, 0, 0),
    },
}
{
    zone_type = "box",
    pos = vector4(10, 10, 20, 10),
    size = vector3(1, 1, 1)
}
{
    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
}
{
    zone_type = "text",
    text = "Hello World"
    pos = vector4(10, 10, 20, 10),
    size = vector3(1, 1, 1)
}
lib.blip.register(id, data)

id

String

Unique reference for the blip

data

Object

Options for the blip, see Data Structure

local blip = lib.blip.get(id)

id

String

Unique reference for the blip

lib.blip.delete(id)

id

String

Unique reference for the blip

{
    -- 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,                  
}
https://docs.fivem.net/docs/game-references/blips/#blips
https://docs.fivem.net/natives/?_0x9029B2F3DA924928
https://docs.fivem.net/docs/game-references/blips/#blip-colors
https://docs.fivem.net/natives/?_0x234CDD44D996FD9A

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

  -- 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)
Getting Started

Getting Started

Server Vars

These are some settings you can use to tailor the lib to your needs you can also make a new file within the same directory as your server.cfg and call it dirk_lib.cfgand then you can simply put exec dirk_lib.cfg in your server.cfg somewhere before dirk_lib is ensured

Convars

If you are setting framework/inventory/target etc please make sure you use the exact resource name so the bridging will work correctly. You can easily reference all the bridge resources by checking the bridge folder, you can also easily add your own bridging here for resources that are not yet supported

# 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

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

shared_scripts {
  '@dirk_lib/init.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

dirk_libs {
  'math',
  'objects'
}

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.

SUPPORTED RESOURCES

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

weight = 1000
description = "A wrench is a tool used to provide grip and mechanical advantage in applying torque to turn objects—usually rotary fasteners, such as nuts and bolts—or keep them from turning."
chanceOfBreak = 100
holdRotation = vector3(0.0, 0.0, 0.0)
holdOffset = vector3(0.0, 0.0, -0.18)
model = "imp_prop_axel_stand_01a"
useable = function(source)
  useJackStand(source, "jackstand")
end
strength = 1500

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

Installation

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 clean_lib ox_lib

Converting Data from Older Version

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

Inventory Instructions

OX_INVENTORY/CLEAN_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',

},

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

Parts

Parts that need to be added to the vehicle for completion.

If bone and bone doesnt exist on the vehicle, it will default to fitted to prevent unfinishable projects


label:

type: string

Example

searchChance:

type: number

Set to 0 if you dont want this item to be searchable

  • Think of names in a hat, how many times is this name in the hat?

Example

weight:

type: number

  • The weight of the item in the inventory

Example

tools?:

type: table (object)

  • Tools required to fit this part ex: {funnel = 1}

    • item?: number Quantity required

Example

consumables?:

type: table (object)

  • Consumables required to fit this part, these will be removed.

    • item?: number Quantity required

Example

anim?:

type: table (object)

  • dict?: string

    • Must specify either scenario or dict

  • clip: string

  • flag?: number

  • time?: number time required to fit the part

Example

reqParts?:

type: table (array)

  • other part names required before fitting this part

Example

model?:

type: string (prop name)

  • the model name of part that is carried in hand/placed on floor whilst installing

Example

applyRange?:

type: number

  • the maximum range from vehicle this part can be installed

Example

applyAtBone?:

type: string

  • the bone where this part needs to be applied at (ex: "engine" for coolant)

Example

canStart?:

function triggered when trying to start project vehicle

type: function(itemExists, _type)

Parameters

type: boolean

if this part is applied or not

type: string

the part name / type

Return

Wether or not the car can start, based on this part

Message to show after checking

Example

removePart?:

function triggered to remove parts from base vehicle

type: function(self, entity, _type)

type: object

the car object

type: number

The client entity handle (entity ID)

type: string

the name of part added

Example

addPart?:

function triggered when part is added

type: function(self, entity, _type)

type: object

the car object

type: number

The client entity handle (entity ID)

type: string

the name of part added

Example

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:

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

weight = 1,
tools = {wrench = 1},
consumables = {bolts = 5},
anim = {
    dict = "anim@amb@clubhouse@tutorial@bkr_tut_ig3@",
    anim = "machinic_loop_mechandplayer",
    time = 10000
},
reqParts = {"engine"},
model = "prop_oiltub_03",
applyRange = 1.5,
applyAtBone = "engine",
canStart = function(itemExists, _type)
      if not itemExists then
            return false, string.format("Missing wheel %s", _type == "wheel_lf" and "left front" or _type == "wheel_rf" and "right front" or _type == "wheel_lr" and "left rear" or _type == "wheel_rr" and "right rear")
      end
end,
removePart  = function(self, entity, _type)
      SetVehicleColours(entity, 14, 14)
end,
    addPart     = function(self, entity, _type)
      local thisCar = projectCar.getByEntity(entity)
      local colorData = thisCar.parts['carpaint'].colors
      if colorData then
        local primaryColor = colorData.primary
        if primaryColor then
          SetVehicleCustomPrimaryColour(entity, primaryColor.r, primaryColor.g, primaryColor.b)
        end
        local secondaryColor = colorData.secondary
        if secondaryColor then
          SetVehicleCustomSecondaryColour(entity, secondaryColor.r, secondaryColor.g, secondaryColor.b)
        end
      end
    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
tools = {
  itemName = {
    label      = "Item Name",
    weight      = 1000,
    description = "A description of the item",
    chanceOfBreak = 100, --## 100% chance of breaking
  }
}
label = "Wrench"
    ['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, 
          },
        },
      },
    },
label = "Coolant",
searchChance  = 10,
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,
})