MSK Scripts
TebexGithubDiscordMusiker15
  • MSK Scripts
    • Welcome
  • Common Issues
    • Keymaster
  • Miscellaneous
    • Change Notifications
  • Scripts
    • MSK Core
      • Installation
      • Functions
        • Client
          • Ace Permission
          • Commands
          • Coords
          • Player
          • Points
          • Request
          • Scaleform
          • UI
            • Input
            • Numpad
            • Progressbar
            • TextUI
          • Vehicle
        • Shared
          • String
          • Math
          • Table
          • Timeout
          • Vector
        • Server
          • Ace Permission
          • Ban System
          • Commands
          • Player
          • Scaleform
          • UI
            • Input
            • Numpad
            • Progressbar
            • TextUI
    • MSK Banking
      • Installation
        • Paycheck Transaction
      • Config
      • Exports
        • Client
        • Server
      • Events
        • Client
        • Server
      • Server Callbacks
    • MSK EngineToggle
      • Guides
      • Exports
        • Client
      • Event Handler
        • Client
        • Server
    • MSK Fuel
      • Config
      • Exports
        • Client
    • MSK Garage
      • Config
      • Exports
        • Client
    • MSK Handcuffs
      • Guides
        • General Edits for Jobs
        • Jaksam Job Creator
        • Multichar
        • ox_inventory
      • Config
      • Admin Commands
      • Exports
        • Client
        • Server
      • Events
        • Client
        • Server
      • Event Handlers
    • MSK Radio
      • Config
      • Exports
        • Client
        • Server
      • Events
        • Server
    • MSK Simcard
      • Installation
        • Config.Database
      • Config
    • MSK VehicleKeys
      • Guides
        • Installation
        • Integrations
      • Config
      • Admin Commands
      • Exports
        • Client
        • Server
    • MSK Whitelist
      • Config
      • Exports
        • Client
        • Server
    • MSK Weaponammo
Powered by GitBook
On this page
  1. Scripts
  2. MSK VehicleKeys
  3. Guides

Integrations

Integrations Guide

Last updated 7 months ago

You need msk_core! -

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

It is already integrated in and

EngineToggle Scripts
  • Use on clientside

  • Use on serverside

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)
    SetVehicleFuelLevel(vehicle, 100.0)
    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)
    Wait(2000) -- To make sure the vehicle is saved in databasse
    exports.msk_vehiclekeys:AddPrimaryKey({source = playerId}, {plate = plate})
end)
jobs_creator
  • Go to jobs_creator/integrations/cl_integrations.lua and add the following Events:

AddEventHandler("jobs_creator:permanent_garage:vehicleSpawned", function(vehicle, vehicleName, vehiclePlate)
    Wait(2000) -- to make sure u are in the vehicle when the key is given
    exports.msk_vehiclekeys:AddPrimaryKey(vehicle)
end)

AddEventHandler("jobs_creator:permanent_garage:vehicleParked", function(vehicleModel, vehiclePlate)
    exports.msk_vehiclekeys:RemovePrimaryKey({plate = vehiclePlate, model = vehicleModel})
end)

AddEventHandler("jobs_creator:garage_owned:vehicleSpawned", function(vehicle, vehicleName, vehiclePlate)
    Wait(2000) -- to make sure u are in the vehicle when the key is given
    exports.msk_vehiclekeys:AddPrimaryKey(vehicle)
end)

AddEventHandler("jobs_creator:garage_owned:vehicleParked", function(vehicleModel, vehiclePlate)
    exports.msk_vehiclekeys:RemovePrimaryKey({plate = vehiclePlate, model = vehicleModel})
end)

AddEventHandler("jobs_creator:temporary_garage:vehicleSpawned", function(vehicle, vehicleName, vehiclePlate)
    Wait(2000) -- to make sure u are in the vehicle when the key is given
    exports.msk_vehiclekeys:AddTempKey(vehicle)
end)

AddEventHandler("jobs_creator:temporary_garage:vehicleParked", function(vehicleModel, vehiclePlate)
    exports.msk_vehiclekeys:RemoveTempKey({plate = vehiclePlate, model = vehicleModel})
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

Download it here
MSK EngineToggle
MSK Garage
this Export
this Export