T1GER Keys

Documentation, troubleshooting and support for T1GER Keys resource.

INSTALLATION

DEPENDENCIES

Dependency

Download

Install

Description

ProgressBars

Optional

If not using, setConfig.ProgressBars to false inconfig.lua

START

  1. Extractt1ger_keys.rar and place it into your resource folder.

  2. Install the SQL file into your database (⚠️see #SQL for instructions).

  3. Install and ensure dependencies for the resource.

  4. Setupconfig.lua (⚠️see #CONFIGURATION for instructions).

  5. Addensure t1ger_keysto your server start config (place it anywhere below the dependency & framework resources).

  6. Update the SetVehicleDoorsLocked() native in all your resources to use my export function instead (see instructions here)

SQL

Please note, there are two SQL files, you only need to use one of them, depending on whether you had my oldt1ger_keys resource installed or not. If you already havegotKey andalarm columns in yourowned_vehicles table in database, then uset1ger_keys_update.sql file. Otherwise, you can use thet1ger_keys_add.sqlfile. You can open the respective SQL file, copy the queries and execute/run them in your database manually (my personal preferred way) or you can import the file.

CONFIGURATION

Please go through all configurable options & settings in config.lua and configure them to your server's preferences.

Also please read the comments at the end of each line, for a brief information on what the option does.

UTILITIES

Inclient/utils.lua there is a file where you can edit some utility functions. In here you can customize notifications, draw texts and many other functions. Please do read it through and make changes to meet your server's preferences.

VEHICLE LOCKED STATUS

You need to replace theSetVehicleDoorsLocked() native with my export function below. This is because my resource uses decors which syncs much better and when using the native to lock/unlock a vehicle, the decors of the vehicle aren't updated, meaning you'd face syncing issues.

exports['t1ger_keys']:SetVehicleLocked(vehicle, int)
-- vehicle is the vehicle entity that you want to execute the function on.
-- int is the lock door status interger (0 or 1 is unlocked, 2 or 10 is locked)
-- (see more here: https://docs.fivem.net/natives/?_0xB664292EAECF7FA6)

Best and easiest way to replace, is simply search forSetVehicleDoorsLocked( in your files and replace with my export function. Reminder; make sure to set the correct variables for vehicle and int, they have to be the exact same as you had in the native you replaced/about to replace.

If you don't want vehicles locked by default when spawned, then manually add the export function and set theint to either0 or1.

I have added the export inside myESX.Game.SpawnVehicle() function, so all my resources using this function, will automatically set vehicles to be unlocked. For resources not using that function, you'd need to add the export in manually in the script.

ADDING KEYS

Follow these instructions to add keys for player or jobs for a vehicle.

JOB KEYS

To add job keys for a vehicle used for a job, use this export function in your client-sided files:

exports['t1ger_keys']:GiveJobKeys(plate, name, boolean, jobs)
-- plate; is the plate variable of the vehicle 
-- name; is the vehicle display name, using GetLabelText() and GetDisplayNameFromVehicleModel()
-- boolean; is true/false, where true add keys to the player, false doesnt add keys to the player
-- jobs; is a table of jobs, that should have lock/unlock access to the vehicle

CLICK THE TABS TO SEE OPTIONS

This example shows how to add job keys for a player and not allowing any jobs to have access to the vehicle.

exports['t1ger_keys']:GiveJobKeys(plate, name, true)
-- plate is the vehicle plate
-- name is the vehicle display name
-- source player keeps the keys
-- last variable is indifferent, as its not for any jobs.

TEMPORARY KEYS

To add temporary keys to a vehicle for player, you need to use this export function in your client-sided files.

exports['t1ger_keys']:GiveTemporaryKeys(plate, name, type)
-- plate; is the plate variable of the vehicle 
-- name; is the vehicle display name, using GetLabelText() and GetDisplayNameFromVehicleModel()
-- type; is the label shown in keys menu, after the plate.
-- I for example use: 'stolen' -for keys gotten from NPCs at gunpoint aim

OWNED KEYS

VEHICLE MUST EXIST IN DATABASE, ONLY AFTER THE FUNCTION OR TRIGGERSERVEREVENT MUST BE USED.

To add keys for owned vehicle, which are permanent, it requires the vehicle to be registered inowned_vehicles table in the database (of course, otherwise it wouldn't be an owned vehicle).

CLICK THE TABS TO SEE OPTIONS

Use this export function to add keys from a server-sided environment:

exports['t1ger_keys']:UpdateKeysToDatabase(plate, state)
-- plate; plate of the vehicle in database that needs its keys state updated.
-- state; set it to true/false, where true means adding keys, false means removing keys.
-- example: https://ibb.co/vDx6czs

MISCELLANEOUS

CHAT COMMANDS

Please note, all these command strings are configurable and can be disabled as well.

Command

Description

/lock

Locks or unlocks the closest vehicle or the vehicle player is in.

/keys

Opens menu showing all current keys a player has.

/carmenu

Opens the car interaction menu (doors, windows, engine, neon and keys)

/engine

Toggles engine on/off depending on its running state.

/lockpick

Triggers the lockpick event/function

/search

Search the car for loot if possible.

/hotwire

Hotwire vehicle to turn on the engine

EXPORTS

These are available exports in the resource - use them as you please and find necessary.

Export Function

Description

exports['t1ger_keys']:SetVehicleLocked(vehicle, int)

Sets the vehicle locked status using decors and handles the door lock sync properly for the vehicle. More info here.

exports['t1ger_keys']:GetVehicleLockedStatus(vehicle)

Returns the locked status integer for a given vehicle. Use this function to check if vehicle is locked. Replace this native with the export function, to get better synced results.

exports['t1ger_keys']:SetVehicleCanSearch(vehicle, boolean)

By default vehicles cannot be searched (unless its enabled for different events in config). Use this export on a given vehicle to allow searching it once. Boolean must betrue .

exports['t1ger_keys']:SetVehicleHotwire(vehicle, boolean)

By default vehicles does not require hotwiring (unless its enabled for different events in config). Use this export on a given vehicle to require a hotwiring to start the engine. Boolean must betrue.

exports['t1ger_keys']:ToggleVehicleEngine(vehicle)

Toggle vehicle engine, depending on its running state. The vehicle variable is not necessary to be sent, function will check for the vehicle player is in.

SCRIPT NOT WORKING / ERRORS

VEHICLE NAME NULL My vehicles show up as NULL and not by name.

✔️ Please read this post on CFX Forum on how to properly add custom vehicles to your server. If that didn't fix your issue, then find the respectivevehicles.meta file (typically located in your stream folder for the given vehicle). In here you want to set the<gameName> property to match the given vehicle mode in yourvehicles table in database. There is a youtube guide here, I don't understand the language but the video itself should give you an idea.

SPAWNED VEHICLES ARE LOCKED I spawn a vehicle, exit the vehicle, try to enter it but it's locked.

✔️ Please see this part of the documentation, for instructions on how to locked status of spawned vehicles: click here.

TRUNK / GLOVEBOX I cannot access my trunk/glovebox; it says vehicle is locked.

✔️ You need to update your relevant resources to use my export function for getting the vehicle locked status:

exports['t1ger_keys']:GetVehicleLockedStatus(vehicle)

TEMPORARY/JOB KEYS NOT WORKING Added temporary or job keys for a given vehicle does not work. I can not lock/unlock.

✔️ Please see this part of the documentation, for instructions on how to properly add job or temporary keys: click here.

🆘 IF YOU HAVE TRIED YOUR BEST AND NOTHING WORKS, THEN CONTACT US ON OUR OFFICIAL DISCORD: CLICK HERE.

Last updated