All documentation

USIN | Advanced Carlock System 🔐

Paid resources

USIN Advanced Carlock System is a comprehensive car locking system that is highly customizable!

Installation

  • Buy the script from my Tebex.
  • Download it from Keymasters.
  • Extract it and drag it to you resources folder.
  • Add “ensure usin_carlock” to you server.cfg file.
  • Add the sql file into your database.
  • Configure the script to your likings in the “config.lua” file.

Features

  • Locking/unlocking vehicle via ox_target, button or command. (configurable)
  • Sharing/unsharing personal vehicle keys via ox_target or command. (configurable)
  • Checking keys shared with you via command.
  • Locking/unlocking job owned vehiles. (configurable)
  • Lock/unlock sound and animation. (configurable)
  • Discord logging via webhook.
  • Different notification options.

Config

Showcase of the config.lua file
Config = {}

– — Notification System Selection — – Choose your preferred notification system. – Options: ‘ox_lib’, ‘esx’, ‘okok’, ‘wasabi’, ‘custom’ Config.NotifySystem = ‘ox_lib’ – Default is ox_lib

– Placeholder for your custom notification logic if Config.NotifySystem = ‘custom’ –[[ Parameters passed: data = { key = string, – The internal key for this notification (e.g., ‘no_keys’) prefix = string, – The Config.NotifyPrefix message = string, – The fully formatted message text type = string, – The type (‘error’, ‘success’, ‘warning’, ‘inform’) duration = number, – The configured duration dynamicData = table – Any extra data passed for formatting (e.g., {playerName, vehicleName}) }, isServer = boolean, – True if called from server.lua, false if client.lua targetSource = number – Player source ID (only provided if isServer is true) –]] Config.CustomNotifyFunction = function(data, isServer, targetSource) if isServer then print(string.format("[Custom Notify - Server -> Client %d] Key: %s, Msg: %s", targetSource, data.key, data.message)) – Example: Trigger your custom client event – TriggerClientEvent(‘my_custom_notify:show’, targetSource, data.message, data.type) else print(string.format("[Custom Notify - Client] Key: %s, Msg: %s", data.key, data.message)) – Example: Call your custom client export – exports[‘my_custom_notify’]:Show(data.message, data.type) end end

– — Notification Messages & Settings — Config.NotifyPrefix = "Vehicle Keys" – Default title/prefix for most systems Config.Notifications = { – Client-Side Triggers no_veh_cmd_lock = { enabled = true, message = "No vehicle nearby to lock.", type = ‘error’, duration = 4000 }, no_veh_cmd_unlock = { enabled = true, message = "No vehicle nearby to unlock.", type = ‘error’, duration = 4000 }, usage_share = { enabled = true, message = "Usage: /%s [Player ID]", type = ‘error’, duration = 5000 }, – {Config.ShareKeyCommand} usage_unshare = { enabled = true, message = "Usage: /%s [Player ID]", type = ‘error’, duration = 5000 }, – {Config.UnshareKeyCommand} no_owned_share = { enabled = true, message = "You don’t own any vehicles to share.", type = ‘error’, duration = 5000 }, no_keys_to_revoke = { enabled = true, message = "No keys shared to this player.", type = ‘error’, duration = 5000 }, no_shared_keys = { enabled = true, message = "You don’t have any shared keys.", type = ‘inform’, duration = 4000 }, locked = { enabled = true, message = "Locked your %s 🔒", type = ‘warning’, duration = 2500 }, – {vehicleName} unlocked = { enabled = true, message = "Unlocked your %s 🔓", type = ‘success’, duration = 2500 }, – {vehicleName}

-- Server-Side Triggers (sent to specific client)
no_plate =          { enabled = true, message = "Could not identify vehicle plate.", type = 'error', duration = 5000 },
no_record =         { enabled = true, message = "No record of this vehicle.", type = 'error', duration = 5000 },
no_keys =           { enabled = true, message = "You don’t have keys for this vehicle.", type = 'error', duration = 4000 },
player_not_found =  { enabled = true, message = "Target player not found.", type = 'error', duration = 5000 },
not_owner_share =   { enabled = true, message = "You do not own this vehicle.", type = 'error', duration = 5000 },
key_shared_sender = { enabled = true, message = "Key for [%s] shared with %s.", type = 'success', duration = 5000 }, -- {plate, targetName}
key_shared_receiver={ enabled = true, message = "%s shared a vehicle key [%s] with you!", type = 'inform', duration = 6000 }, -- {senderName, plate}
key_already_shared= { enabled = true, message = "Key for [%s] is already shared with %s.", type = 'warning', duration = 5000 }, -- {plate, targetName}
key_revoked_sender= { enabled = true, message = "Key for [%s] revoked from %s.", type = 'warning', duration = 5000 }, -- {plate, targetName}
key_revoked_receiver={ enabled = true, message = "%s revoked your vehicle key for [%s].", type = 'error', duration = 6000 }, -- {senderName, plate}
key_not_shared_revoke={enabled = true, message = "Key for [%s] was not shared with %s by you.", type = 'error', duration = 5000 } -- {plate, targetName}

}

– — Feature Toggles — Config.EnableLockUnlockCommands = true Config.EnableShareKeyCommands = true Config.EnableVehicleTarget = true Config.EnablePlayerTarget = true Config.EnableKeybind = true

– — Keybinds —

Config.LockKeybind = "L"

– — Command Names — Config.LockCommand = "lockveh" Config.UnlockCommand = "unlockveh" Config.ShareKeyCommand = "sharekey" Config.UnshareKeyCommand = "unsharekey"

– — Command/Target Settings — Config.CommandLockDistance = 10.0 Config.KeybindActionName = "UsinCarlock:ToggleKeybindAction" – (no need to modify this)

– — ox_target Vehicle Settings — Config.VehicleTarget = { Lock = { label = "Lock Vehicle", icon = "fas fa-lock", iconColor = "orange", distance = 7.0 },

Unlock = { 
    label = "Unlock Vehicle", 
    icon = "fas fa-unlock", 
    iconColor = "green", 
    distance = 7.0 
}

}

– — ox_target Player Settings — Config.PlayerTarget = { ShareKey = { label = "Share Vehicle Key", icon = "fas fa-share-alt", iconColor = "green", distance = 2.0 },

UnshareKey = { 
    label = "Unshare Vehicle Key", 
    icon = "fas fa-user-minus", 
    iconColor = "red", 
    distance = 2.0 
}

}

– — Job Vehicle Ownership Style — –[[ Set this to how your ‘owned_vehicles’ table stores job/society ownership in the ‘owner’ column. Options: ‘society_colon_job’: Checks for "society:jobname" (e.g., owner = "society:police") ‘job_direct’: Checks for "jobname" directly (e.g., owner = "police") –]] Config.JobVehicleOwnerStyle = ‘job_direct’

– Discord Webhook for logging Config.DiscordWebhook = ‘YOUR_DISCORD_WEBHOOK_HERE’ Config.EnableDiscordLogs = false – Set to true if you want discord logs.

SQL

Install this into your database!
CREATE TABLE IF NOT EXISTS `shared_keys` (
  `owner` VARCHAR(64) NOT NULL,
  `receiver` VARCHAR(64) NOT NULL,
  `plate` VARCHAR(12) NOT NULL,
  PRIMARY KEY (`owner`, `receiver`, `plate`)
);

Pictures

Showcasing the script!

Documentation imageDocumentation imageDocumentation imageDocumentation imageDocumentation imageDocumentation imageDocumentation imageDocumentation image

Video

Watch the video

Search documentation

Start typing to search every guide.