Vehicle Keys
Functions
Client-side vehicle key functions supporting 13+ key systems.
The Keys adapter provides unified vehicle key management across multiple systems.
Functions
give
Gives the player keys for a vehicle.
FM.keys.give(vehicle)
vehicle
number required
Vehicle entity handle to give keys for
Returns: boolean|nil - True if keys were given successfully
Example:
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if vehicle ~= 0 then
FM.keys.give(vehicle)
FM.framework.notify("You received vehicle keys", "success")
end
remove
Removes the player's keys for a vehicle.
FM.keys.remove(vehicle)
vehicle
number required
Vehicle entity handle to remove keys for
Returns: boolean|nil - True if keys were removed successfully
Example:
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if vehicle ~= 0 then
FM.keys.remove(vehicle)
FM.framework.notify("Vehicle keys removed", "info")
end
has
Checks if the player has keys for a vehicle.
FM.keys.has(vehicle)
vehicle
number required
Vehicle entity handle to check keys for
Returns: boolean - True if player has keys for the vehicle
Example:
local vehicle = GetVehiclePedIsIn(PlayerPedId(), false)
if vehicle ~= 0 then
if FM.keys.has(vehicle) then
print("You have keys for this vehicle")
-- Allow engine start
else
print("You don't have keys")
-- Require hotwire or lockpick
end
end
Exports
All vehicle key functions are available as exports:
exports['fmLib']:keys_give(vehicle)
exports['fmLib']:keys_remove(vehicle)
exports['fmLib']:keys_has(vehicle)
