Custom Key System
If we don't support your key system out of the box, it's super easy to add your own!
Go to the
framework
folder, and opencl-functions.lua
Find the
VehicleGiveKeys
andVehicleRemoveKeys
functions, which should look something like this:
Inside the
VehicleGiveKeys
function, within theelse
block where it saysreturn 65 -- Setup custom key system here...
replacing it with your custom give keys export. Also make sure you are providing the correct variables to the export based on the ones available:plate
- Vehicle platevehicleEntity
- Physical vehicle entity If you need to get the vehicle model/spawn code, you can use:local model = GetDisplayNameFromVehicleModel(GetEntityModel(vehicleEntity))
If your key script has the ability to remove keys, you can do the same inside the
VehicleRemoveKeys
function replacing the line that says-- Setup custom key system here...
with the remove keys export of your key script. Again, ensure you are using variables from the ones available,plate
andvehicleEntity
Make sure that in the Configurator or
config.lua
you have set the VehicleKeys tonone
.
Last updated