Integrations

Integrations Guide

You need msk_core! - Download it here

This Guide show examples on how to integrate msk_vehiclekeys into f.e.: VehicleShops, etc.

okokVehicleShop
  • Go to okokVehicleshop\cl_utils.lua and edit the following Events:

RegisterNetEvent(Config.EventPrefix..":giveKeys")
AddEventHandler(Config.EventPrefix..":giveKeys", function(vehicle)
    Wait(2000) -- to make sure u are in the vehicle when the key is given

    exports.msk_vehiclekeys:AddPrimaryKey(vehicle)
end)

RegisterNetEvent(Config.EventPrefix..":giveKeysTestDrive")
AddEventHandler(Config.EventPrefix..":giveKeysTestDrive", function(vehicle)
    Wait(2000) -- to make sure u are in the vehicle when the key is given

    exports.msk_vehiclekeys:AddTempKey(vehicle)
end)

RegisterNetEvent(Config.EventPrefix..":giveKeysTowTruck")
AddEventHandler(Config.EventPrefix..":giveKeysTowTruck", function(vehicle)
    Wait(2000) -- to make sure u are in the vehicle when the key is given

    exports.msk_vehiclekeys:AddTempKey(vehicle)
end)

RegisterNetEvent(Config.EventPrefix..":onFinishTestDrive")
AddEventHandler(Config.EventPrefix..":onFinishTestDrive", function(vehicle)
    exports.msk_vehiclekeys:RemoveTempKey(vehicle)
end)

RegisterNetEvent(Config.EventPrefix..":deleteVehicle")
AddEventHandler(Config.EventPrefix..":deleteVehicle", function()
    if sellingVehicle ~= nil then
	exports.msk_vehiclekeys:RemovePrimaryKey(sellingVehicle)
	DeleteEntity(sellingVehicle)
	sellingVehicle = nil
    end
end)
dealerships_creator
  • Go to dealerships_creator/integrations/cl_integrations.lua and add the following Events:

AddEventHandler("dealerships_creator:testDrive:vehicleSpawned", function(vehicle, vehicleNetId)
    exports.msk_vehiclekeys:AddTempKey(vehicle)
end)
  • Go to dealerships_creator/integrations/sv_integrations.lua and add the following Events:

AddEventHandler("dealerships_creator:giveVehicleToPlayerId", function(playerId, vehicleName, plate)
    exports.msk_vehiclekeys:AddPrimaryKey({source = playerId}, plate)
end)
qs-advancedgarages
  • Go to qs-advancedgarages\config\config.lua and insert the following on line ~186

local mskvehiclekeys = GetResourceState('msk_vehiclekeys') == 'started'
  • Then insert the following at line 208-210

elseif mskvehiclekeys then
    return 'msk_vehiclekeys'
else
  • Create a new file named msk_vehiclekeys.lua and place this file into: qs-advancedgarages\client\custom\vehiclekeys

  • Add the following code into this file:

if Config.Vehiclekeys ~= 'msk_vehiclekeys' then
    return
end

function AddVehiclekeys(vehicle, plate, item)
    exports.msk_vehiclekeys:AddPrimaryKey(vehicle)
end

function RemoveVehiclekeys(vehicle, plate)
    exports.msk_vehiclekeys:RemovePrimaryKey(vehicle)
end

Last updated