T1GER Scripts Documentation
Tebex StoreDiscordYouTubeCFX Forum
  • T1GER Scripts Documentation
  • Quick Links
    • t1ger.net | Shop Now
    • Join Discord
  • Information
    • FiveM Asset Escrow
  • Resources
    • T1GER Mechanic
      • Installation
        • Job Account
          • Setup
          • API
      • Configuration
        • Config
          • Missions
        • Shop
          • Workbench
          • Supplier
        • Parts
      • Exports
        • Server
        • Client
      • Troubleshoot
        • FAQ
    • T1GER Library
      • Installation
        • Inventory
        • Target
        • Garage
        • Society Account
        • Vehicle Properties
      • Configuration
    • T1GER Gang System
      • Installation
      • Gang Garages
      • Product Information
    • T1GER Tuning System
      • Installation
      • API
        • Client
        • Server
      • Troubleshoot
        • Common Issues
        • Error Codes
      • Guides
        • Commands
        • Shops
        • Markers
        • Mod Stations
        • Pricing
        • Mod Orders
        • Vehicle Mods
        • Engine Swaps
        • Nitrous
    • T1GER ATM Robbery
      • Installation
      • API
        • Client
        • Server
      • Troubleshoot
        • Common Issues
        • Error Codes
      • Guides
        • Hacking Minigame
        • Dispatch
    • T1GER Dealerships
  • Free Resources
    • T1GER Keys
    • T1GER Garage
    • T1GER Bank Robbery
    • T1GER Tow Trucker
Powered by GitBook
On this page
  • INSTALLATION
  • DEPENDENCIES
  • START
  • SQL
  • CONFIGURATION
  • UTILITIES
  • VEHICLE LOCKED STATUS
  • ADDING KEYS
  • JOB KEYS
  • TEMPORARY KEYS
  • OWNED KEYS
  • MISCELLANEOUS
  • CHAT COMMANDS
  • EXPORTS
  • SCRIPT NOT WORKING / ERRORS
  1. Free Resources

T1GER Keys

Documentation, troubleshooting and support for T1GER Keys resource.

PreviousT1GER DealershipsNextT1GER Garage

Last updated 3 months ago

| | |

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.

This example shows how to add job keys for a job or multiple jobs and auto-removes access to the spawned vehicle from players that switches job or goes off-duty.

exports['t1ger_keys']:GiveJobKeys(plate, name, false, {'police','lspd'})
-- plate is the vehicle plate
-- name is the vehicle display name
-- source player loses keys if switching jobs.
-- all players with job 'police' or 'lspd' has access to the vehicle.

This example shows how to add job keys for jobs and allowing source player to keep the keys, in case he switches jobs or goes off-duty.

exports['t1ger_keys']:GiveJobKeys(plate, name, true, {'police'})
-- plate is the vehicle plate
-- name is the vehicle display name
-- true means source player keeps the if he goes off-duty or switch job
-- all players with job 'police' have access to the vehicle.

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

Use this trigger event to add keys from a client-sided environment:

TriggerServerEvent('t1ger_keys:updateOwnedKeys', 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.

When triggering this event from client-sided environments, you really need to make sure that the vehicle is existing in database!

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)

exports['t1ger_keys']:GetVehicleLockedStatus(vehicle)

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

exports['t1ger_keys']:GetVehicleLockedStatus(vehicle)

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

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

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

Please read 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 , 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:

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

❓
✔️
this post
youtube guide here
❓
✔️
❓
✔️
❓
✔️
🆘
CLICK HERE
here
Link
native
View on Tebex
CFX Forum Post
YouTube Showcase
Discord
Example of adding unlocked state to vehicle spawned using ESX.Game.SpawnVehicle function.
Example of adding job keys to a player and not allowing any jobs (code is from T1GER Garage)
Example of adding job keys to a job/multiple jobs (code is from T1GER Garage)
Example of adding job keys to a job and letting source player keep the keys (code is from T1GER Garage)
Example of adding temporary keys (code snippet from T1GER Keys)
Example of adding the export function to add keys after the purchase in T1GER Cardealer