Garage - Car key

Edit garage and car key commands

Add Car Key

This function, located in gksphone/client/settings.lua, is used to give the player the vehicle key. It works based on the vehicle key script installed on the server.

--- Function to give a key to a car
--- Located in: gksphone/client/settings.lua
--- Modify this function according to your key system
--- @param callback_vehicle number The vehicle entity
function GiveKeyCar(callback_vehicle)
  if GetResourceState('qs-vehiclekeys') == 'started' then
    local model = GetDisplayNameFromVehicleModel(GetEntityModel(callback_vehicle))
    local plate = GetVehicleNumberPlateText(callback_vehicle)
    exports['qs-vehiclekeys']:GiveKeys(plate, model, true)
  elseif GetResourceState('qb-vehiclekeys') == 'started' then
    local plate = GetVehicleNumberPlateText(callback_vehicle)
    TriggerEvent("vehiclekeys:client:SetOwner", plate)
  end
  -- New systems can be added here ↓↓↓
  -- local plate = GetVehicleNumberPlateText(callback_vehicle)
  -- Add the export or trigger of the key command you are using here
end

Garage

You will edit the framework file you are using in the gksphone/server/framework/ directory.

Garage SQL

Set the default options for the following sections according to your garage script.

Car status info

This section determines whether the vehicle is outside or impounded according to the garage script.

Bring control

This function checks whether the car called is impounded or outside.

After Bring

Changing some parts in SQL when bringing a car

Last updated