Installation

Installation Guide

You need msk_core! - Download it here

  • Drag & Drop the folder msk_vehiclekeys into your resource folder

  • Add ensure msk_vehiclekeys in your server.cfg

  • Configure the config.lua

  • Set your current Framework at Config.Framework

  • Set the Hotkeys that you want (Users can change it by themself in fivem keybind settings)

  • Add the itemName in Config.Settings to your inventory or database

  • Activate or deactivate uniqueItems if your are using one of the supported inventories

MSK VehicleKeys don't need any SQL file. All vehicle keys will be saved in vehiclekeys.json.

Do NOT add or delete anything in vehiclekeys.json! This will be overwritten as the script saves the data every 5 minutes and when the script was stopped.

Supported Inventories

You don’t have to have the listed inventories below, but without them, you won’t have unique items!

We have no plans to support further inventories but you can still make suggestions.

We recommend using ox_inventory for Unique Items because with this inventory we can Add or Remove the Players Key automatically if he Drops, Give, etc. the Key Item (except TempKeys).

Also the Keyring System is currently only for ox_inventory!

Why those features, mentioned above, only for ox_inventory? Because ox_inventory offers numerous functions that other inventories unfortunately do not support.

You can find the code for that in server/main.lua and for ox_inventory in server/ox_inventory.lua. Maybe you can add that yourself...

Items

There are some different items that you need to add to your inventory or database. You can change them in config.lua if you want to give them a different name.

  • keys - The Vehicle Key Item

  • keyring - Item to open your Keyring (Only ox_inventory)

  • contract - Item to sell your vehicle to antoher player

ox_inventory
  • Go to ox_inventory/data/items.lua and add the items:

/data/items.lua
["keys"] = {
    label = "Vehicle Key",
    description = "Key for a Vehicle",
    weight = 35,
    stack = false,
    close = true,
    client = {
        export = 'msk_vehiclekeys.toggleLock'
    },
},

["contract"] = {
    label = "Contract",
    description = "Contract to sell your vehicle",
    weight = 10,
    stack = true,
    close = true,
    client = {
        export = 'msk_vehiclekeys.openDialog'
    },
},

["keyring"] = {
    label = "Vehicle Keyring",
    description = "Keyring for your Vehicle Keys",
    weight = 10,
    stack = false,
    close = false,
    consume = 0,
},
  • Go to ox_inventory/modules/items/containers.lua and add the following:

/modules/items/containers.lua
setContainerProperties('keyring', {
	slots = 500, -- Set Slots
	maxWeight = 100000, -- Set max weight
	whitelist = { 'keys' } -- Do NOT touch this one!
})

It should look like this:

  • Restart your server and have fun :)

qs-inventory
  • Go to qs-inventory\config\metadata.js

  • Go to line ~54 and insert the following:

} else if (itemData.name == "keys") { 
    $(".item-info-title").html("<p>" + label + "</p>");
    $(".item-info-description").html(
        itemData.info.description +
        "</span></p>"
    );
}
  • It should look like this:

} else if (itemData.name == "tradingcard_psa") {
    $(".item-info-title").html("<p>" + label + "</p>");
    $(".item-info-description").html(
        "<p><strong>PSA ID: </strong><span>" +
        itemData.info.serial +
        "</span></p>"
    );
 } else if (itemData.name == "keys") {
    $(".item-info-title").html("<p>" + label + "</p>");
    $(".item-info-description").html(
        itemData.info.description +
        "</span></p>"
    );
} else if (itemData.name == "photo") {
    $(".item-info-title").html("<p>" + `${itemData.info.label || label}` + "</p>");
    $(".item-info-description").html(
        "<p><span>" +
        itemData.info.location +
        "</span></p><span>" +
        itemData.info.date + "</span></p>"
    );
}
  • Then go to qs-inventory\shared\items.lua and insert the keys item

['keys'] = { -- must be the same as in your msk_vehiclekeys config.lua (itemName = 'keys',) 
    ['name'] = 'keys', -- must be the same as in your msk_vehiclekeys config.lua (itemName = 'keys',) 
    ['label'] = 'Vehicle Key',
    ['weight'] = 35,
    ['type'] = 'item',
    ['image'] = 'keys.png',
    ['unique'] = true,
    ['useable'] = true,
    ['shouldClose'] = true,
    ['combinable'] = nil,
    ['description'] = 'Key for a Vehicle'
},

['contract'] = { -- must be the same as in your msk_vehiclekeys config.lua (itemName = 'contract',) 
    ['name'] = 'contract', -- must be the same as in your msk_vehiclekeys config.lua (itemName = 'contract',) 
    ['label'] = 'Contract',
    ['weight'] = 1,
    ['type'] = 'item',
    ['image'] = 'contract.png',
    ['unique'] = false,
    ['useable'] = true,
    ['shouldClose'] = true,
    ['combinable'] = nil,
    ['description'] = 'Contract to sell your vehicle'
},

Last updated