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

CONFIGURATION

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.

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.

Example of adding unlocked state to vehicle spawned using ESX.Game.SpawnVehicle function.

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

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.
Example of adding job keys to a player and not allowing any jobs (code is from T1GER Garage)

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
Example of adding temporary keys (code snippet from T1GER Keys)

OWNED KEYS

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

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
Example of adding the export function to add keys after the purchase in T1GER Cardealer

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

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

Last updated