[ESX] MSK Garage and Impound with NativeUI

Tebex [9.99€ incl. VAT] - Encrypted
Tebex [19.99€ incl. VAT] - Source Code

Images: MSK Garage - Album on Imgur

Description

You can add your own Vehicle Key Script in server_vehiclekeys.lua , but I can only give support for the Scripts that I’ve mentioned below at Optional Requirements !

  • Set as many Garages and Impounds as you want
  • You can use Custom License plates like “CUSTOM”
  • You can park in and park out a vehicle if you have a Key [VehicleKeyChain required] [You can set it to false in config]
  • At the Impound you can set a Waypoint to your vehicle or you can transfer it to the Impound [AdvancedParking required]
  • Set your own Notifications
  • Set NPCs or Markers with 3D Text
  • Support for okokTextUI and esx_textUI
  • Set if you want park out vehicles where you parked it in or if you want to park out vehicles everywhere
  • Set your own Fuel System [default: LegacyFuel]
  • Set Jobs and Grades who can access the Garage or Impound
  • Set if its a car, boat or air Garage [default: all Categories]
  • You can set as many parkout Spots as you want
  • Set the Blip you want or deactivate the Blip

Config

Config = {}
----------------------------------------------------------------
Config.Locale = 'de' -- 'de', 'en'
Config.Debug = true
Config.VersionChecker = true
----------------------------------------------------------------
Config.Hotkey = 38 -- default: 38 = E // Change the Key in translation.lua too

Config.npcVoice = {
    enable = true, -- The NPC will say something to you
    inRange = 5.0,
    outRange = 5.0
}

Config.defaultTextUI = true -- Set false if you want to use a custom textui

Config.openTextUI = function(current)
    exports['okokTextUI']:Open(Translation[Config.Locale]['open_garage_textui']:format(current.label), 'darkblue', 'left')
    -- exports["esx_textui"]:TextUI(Translation[Config.Locale]['open_garage_textui']:format(current.label), 'info')
end

Config.closeTextUI = function()
    exports['okokTextUI']:Close()
    -- exports["esx_textui"]:HideUI()
end

Config.MySQL = { -- Look at your owned_vehicles table and correct this
    type = "type", -- vehicle type (car, boat, air)
    job = "job", 
    stored = "stored",
    civ = "civ", -- Job for Civilist (DON'T TOUCH if job is NULL in owned_vehicles)
}

Config.Parking = 'specific' -- 'all' = Park out every vehicle everywhere // 'specific' = Park out your vehicle where you parked it in.
----------------------------------------------------------------
-- With this Feature you can park in and park out Vehicles if you are not the owner but have a second key
-- VehicleKeyChain -> https://forum.cfx.re/t/release-vehicle-key-chain/3319563
-- vehicles_keys -> https://forum.cfx.re/t/esx-qbcore-vehicles-keys-vehicles-lock-remote-control-ui-and-much-more/4857274
-- You can add your own Key Script in server_vehiclekeys.lua
Config.KeyScript = 'VehicleKeyChain' -- Set to 'VehicleKeyChain' or 'vehicles_keys'

-- With this Feature you can't duplicate vehicles with Impound
Config.AdvancedParking = true -- Set to false if you dont want to use this // https://forum.cfx.re/t/advancedparking-v3-7-0-major-update-esx-qb-standalone/2099582
----------------------------------------------------------------
-- !!! This function is clientside AND serverside !!!
Config.Notification = function(source, message)
    if IsDuplicityVersion() then -- serverside
        MSK.Notification(source, 'MSK Garage', message) -- replace this with your Notify
    else -- clientside
        MSK.Notification('MSK Garage', message) -- replace this with your Notify
    end
end
----------------------------------------------------------------
Config.CustomBanner = true -- Set true to enable Custom Banner
Config.removeTitle = false -- If Custom Banner enabled, it will remove the Title from the NativeUI

Config.garageBanner = function() -- Banner for Garage
    return Sprite.New('banner_blue', 'banner_blue', 0, 0, 512, 128)
end

Config.impoundBanner = function() -- Banner for Impound
    return Sprite.New('banner_blue', 'banner_blue', 0, 0, 512, 128)
end
----------------------------------------------------------------
-- !!! This function is clientside ONLY !!!
Config.SetFuel = function(vehicle, fuel)
    exports['LegacyFuel']:SetFuel(vehicle, fuel) -- LegacyFuel
    -- exports['myFuel']:SetFuel(vehicle, fuel) -- myFuel
    -- SetVehicleFuelLevel(vehicle, fuel + 0.0) -- FiveM Native
    -- Entity(vehicle).state.fuel = fuel -- ox_fuel
end

Config.GetFuel = function(vehicle)
    return exports["LegacyFuel"]:GetFuel(vehicle) -- LegacyFuel
    -- return exports['myFuel']:GetFuel(vehicle) -- myFuel
    -- return GetVehicleFuelLevel(vehicle) -- FiveM Native
    -- return Entity(vehicle).state.fuel -- ox_fuel
end
----------------------------------------------------------------
-- !!! This functions are clientside ONLY !!!

-- This will be triggered after the vehicle is spawned, you can add extra events here.
Config.VehicleSpawned = function(vehicle, plate, fuel, props)
    -- Add your own code here.
end

-- This will be triggered after set to stored in database but before the vehicle gets deleted, you can add extra events here.
Config.VehicleParked = function(vehicle, plate, fuel, props)
    -- Add your own code here.
end
----------------------------------------------------------------
Config.enableImpound = true -- Set false to disable all Impounds
Config.parkoutWithKey = false -- Set true if you want to parkout a vehicle with a key at the Impound

Config.Impounds = {
    ["impound_car"] = {
        label = 'Impound | Car',
        type = {"car"}, -- "car", "boat", "aircraft", "helicopter" // Look into you database for that
        pedmodel = {enable = true, model = 'csb_trafficwarden', distance = 20.0},
        text3d = {enable = true, label = '~g~Open Impound', size = 0.8},
        marker = {enable = true, distance = 5.0, type = 27, size = {a = 1.0, b = 1.0, c = 1.0}, color = {a = 255, b = 255, c = 255}},
        blip = {enable = true, id = 524, color = 17, scale = 0.8},
        locations = { -- Only for NPC and Marker
            {x = 409.0, y = -1622.75, z = 29.29, h = 231.88},
        },
        park_dist = 5.0, -- Distance between Parkout Spots // Don't change this if you don't know what this is
        park_out = { -- You can set multiple locations
            {x = 401.36, y = -1647.98, z = 29.29, h = 318.54},
        },
        warp = false, -- Set false if you don't want to warp into the vehicle
        fee = {enable = true, price = 150, account = 'money' --[['money', 'bank']]} -- Fee to Park out a vehicle
    },
    ["impound_boat"] = {
        label = 'Impound | Boat',
        type = {"boat"}, -- "car", "boat", "aircraft", "helicopter" // Look into you database for that
        pedmodel = {enable = true, model = 'csb_trafficwarden', distance = 20.0},
        text3d = {enable = true, label = '~g~Open Impound', size = 0.8},
        marker = {enable = true, distance = 5.0, type = 27, size = {a = 1.0, b = 1.0, c = 1.0}, color = {a = 255, b = 255, c = 255}},
        blip = {enable = true, id = 410, color = 17, scale = 0.8},
        locations = { -- Only for NPC and Marker
            {x = -788.38, y = -1490.3, z = 1.6, h = 289.21},
        },
        park_dist = 5.0, -- Distance between Parkout Spots // Don't change this if you don't know what this is
        park_out = { -- You can set multiple locations
            {x = -797.84, y = -1490.21, z = -0.47, h = 301.0},
        },
        warp = true, -- Set false if you don't want to warp into the vehicle
        fee = {enable = true, price = 200, account = 'money' --[['money', 'bank']]} -- Fee to Park out a vehicle
    },
    ["impound_heli"] = {
        label = 'Impound | Aircrafts',
        type = {"aircraft", "helicopter"}, -- "car", "boat", "aircraft", "helicopter" // Look into you database for that
        pedmodel = {enable = true, model = 'csb_trafficwarden', distance = 20.0},
        text3d = {enable = true, label = '~g~Open Impound', size = 0.8},
        marker = {enable = true, distance = 5.0, type = 27, size = {a = 1.0, b = 1.0, c = 1.0}, color = {a = 255, b = 255, c = 255}},
        blip = {enable = true, id = 569, color = 17, scale = 0.8},
        locations = { -- Only for NPC and Marker
            {x = -1070.57, y = -2867.78, z = 13.95, h = 152.85},
        },
        park_dist = 5.0, -- Distance between Parkout Spots // Don't change this if you don't know what this is
        park_out = { -- You can set multiple locations
            {x = -1112.54, y = -2883.81, z = 13.95, h = 147.98},
        },
        warp = false, -- Set false if you don't want to warp into the vehicle
        fee = {enable = true, price = 500, account = 'money' --[['money', 'bank']]} -- Fee to Park out a vehicle
    },
}
----------------------------------------------------------------
Config.DefaultGarage = 'A' -- Set this to your default Garage ID

Config.Garages = {
    ----------------------------------------------------------------
    -------------------- Garage Car & Motorcycles ------------------
    ----------------------------------------------------------------

    ["A"] = { -- This is the Garage ID that will be inserted into database
        id = 'A', -- This is the Garage ID that will be inserted into database
        label = 'Garage | Meetingpoint', -- Würfelpark
        type = {"car"}, -- "car", "boat", "aircraft", "helicopter" // Look into you database for that
        distance = 20.0, -- The max distance to park-in vehicles
        jobs = {enable = false, identifier = 'player' --[[identifier from 'player' or 'society']], ownJob = true --[[true: will only show vehicles that are from the same job you are employed at]], jobs = { 
            -- If you set identifier = 'society' then you have to set the identifier in database to the jobname. Example: https://prnt.sc/5YQnA743Yftj
            {job = 'police', grade = 0}, -- owned_vehicles -> job has to be set to 'police'
            {job = 'ambulance', grade = 0}, -- owned_vehicles -> job has to be set to 'ambulance'
        }},
        pedmodel = {enable = true, model = 'csb_trafficwarden', distance = 20.0},
        text3d = {enable = true, label = '~g~Open Garage', size = 0.8},
        marker = {enable = true, distance = 5.0, type = 27, size = {a = 1.0, b = 1.0, c = 1.0}, color = {a = 255, b = 255, c = 255}},
        blip = {enable = true, id = 524, color = 26, scale = 0.8},
        locations = { -- Only for NPC and Marker
            {x = 213.98, y = -808.45, z = 31.01, h = 156.59},
        },
        park_dist = 5.0, -- Distance between Parkout Spots // Don't change this if you don't know what this is
        park_out = { -- You can set multiple locations
            {x = 232.98, y = -790.3, z = 30.6, h = 161.46},
        },
        warp = false, -- Set false if you don't want to warp into the vehicle
    },

    ----------------------------------------------------------------
    ------------------------- Garage Boat --------------------------
    ----------------------------------------------------------------

    ["boat_A"] = { -- This is the Garage ID that will be inserted into database
        id = 'boat_A', -- This is the Garage ID that will be inserted into database
        label = 'Garage | Boat', -- Los Santos Docks
        type = {"boat"}, -- "car", "boat", "aircraft", "helicopter" // Look into you database for that
        distance = 20.0, -- The max distance to park-in vehicles
        jobs = {enable = false, identifier = 'player' --[[identifier from 'player' or 'society']], ownJob = true --[[true: will only show vehicles that are from the same job you are employed at]], jobs = { 
            -- If you set identifier = 'society' then you have to set the identifier in database to the jobname. Example: https://prnt.sc/5YQnA743Yftj
            {job = 'police', grade = 0}, -- owned_vehicles -> job has to be set to 'police'
            {job = 'ambulance', grade = 0}, -- owned_vehicles -> job has to be set to 'ambulance'
        }},
        pedmodel = {enable = true, model = 'csb_trafficwarden', distance = 20.0},
        text3d = {enable = true, label = '~g~Open Garage', size = 0.8},
        marker = {enable = true, distance = 5.0, type = 27, size = {a = 1.0, b = 1.0, c = 1.0}, color = {a = 255, b = 255, c = 255}},
        blip = {enable = true, id = 427, color = 38, scale = 0.8},
        locations = { -- Only for NPC and Marker
            {x = -724.39, y = -1334.67, z = 1.6, h = 49.0},
        },
        park_dist = 5.0, -- Distance between Parkout Spots // Don't change this if you don't know what this is
        park_out = { -- You can set multiple locations
            {x = -731.31, y = -1334.57, z = 2.07, h = 228.46},
        },
        warp = true, -- Set false if you don't want to warp into the vehicle
    },

    ----------------------------------------------------------------
    ----------------------- Garage Helicopter ----------------------
    ----------------------------------------------------------------

    ["heli_A"] = { -- This is the Garage ID that will be inserted into database
        id = 'heli_A', -- This is the Garage ID that will be inserted into database
        label = 'Garage | Helicopter', -- Los Santos Airport
        type = {"helicopter", "aircraft"}, -- "car", "boat", "aircraft", "helicopter" // Look into you database for that
        distance = 20.0, -- The max distance to park-in vehicles
        jobs = {enable = false, identifier = 'player' --[[identifier from 'player' or 'society']], ownJob = true --[[true: will only show vehicles that are from the same job you are employed at]], jobs = { 
            -- If you set identifier = 'society' then you have to set the identifier in database to the jobname. Example: https://prnt.sc/5YQnA743Yftj
            {job = 'police', grade = 0}, -- owned_vehicles -> job has to be set to 'police'
            {job = 'ambulance', grade = 0}, -- owned_vehicles -> job has to be set to 'ambulance'
        }},
        pedmodel = {enable = true, model = 'csb_trafficwarden', distance = 20.0},
        text3d = {enable = true, label = '~g~Open Garage', size = 0.8},
        marker = {enable = true, distance = 5.0, type = 27, size = {a = 1.0, b = 1.0, c = 1.0}, color = {a = 255, b = 255, c = 255}},
        blip = {enable = true, id = 569, color = 30, scale = 0.8},
        locations = { -- Only for NPC and Marker
            {x = -1617.14, y = -3145.52, z = 13.99, h = 0.0},
        },
        park_dist = 5.0, -- Distance between Parkout Spots // Don't change this if you don't know what this is
        park_out = { -- You can set multiple locations
            {x = 4938.64, y = -5139.09, z = 2.09, h = 64.75},
        },
        warp = false, -- Set false if you don't want to warp into the vehicle
    },

    ----------------------------------------------------------------
    ------------------------ Garage for Jobs -----------------------
    ----------------------------------------------------------------

    ["police_mrpd_a"] = { -- This is the Garage ID that will be inserted into database
        id = 'police_mrpd_a', -- This is the Garage ID that will be inserted into database
        label = 'Garage | Police', -- Cayo Perico Airport
        type = {"car"}, -- "car", "boat", "aircraft", "helicopter" // Look into you database for that
        distance = 20.0, -- The max distance to park-in vehicles
        jobs = {enable = true, identifier = 'player' --[[identifier from 'player' or 'society']], ownJob = true --[[true: will only show vehicles that are from the same job you are employed at]], jobs = { 
            -- If you set identifier = 'society' then you have to set the identifier in database to the jobname. Example: https://prnt.sc/5YQnA743Yftj
            {job = 'police', grade = 0}, -- owned_vehicles -> job has to be set to 'police'
        }},
        pedmodel = {enable = true, model = 's_m_y_cop_01', distance = 20.0},
        text3d = {enable = true, label = '~g~Open Garage', size = 0.8},
        marker = {enable = true, distance = 5.0, type = 27, size = {a = 1.0, b = 1.0, c = 1.0}, color = {a = 255, b = 255, c = 255}},
        blip = {enable = false, id = 524, color = 29, scale = 0.8},
        locations = { -- Only for NPC and Marker
            {x = 460.1, y = -986.74, z = 25.7, h = 92.28},
        },
        park_dist = 5.0, -- Distance between Parkout Spots // Don't change this if you don't know what this is
        park_out = { -- You can set multiple locations
            {x = 455.61, y = -980.5, z = 25.7, h = 90.34},
        },
        warp = false, -- Set false if you don't want to warp into the vehicle
    },
}

Optional Requirements

Latest Update

Code is accessible No
Subscription-based No
Lines (approximately) ~ 1000
Requirements ESX Legacy, oxmysql, NativeUI, msk_core
Support Yes

My other Scripts

Paid

Free

3 Likes

Update v1.2

  • Fixed some Bugs with Config.Parking = 'all'
  • Implemented msk_core

Re-download msk_garage at your keymaster

1 Like

Update v1.3

  • Improved performance [idle resmon now 0.00 ms]
  • Fixed some Bugs with VehicleKeychain
  • Added MySQL Config for Civilist job
  • Added multiple jobs for a Garage or Impound

Old

jobs = 'police'
grade = 0

New

jobs = {enable = false, ownJob = true, jobs = { -- ownJob = true will only show vehicles that are from the same job you are employed at
    {job = 'police', grade = 0},
    {job = 'ambulance', grade = 0},
}},
1 Like

Update v1.5

  • Added Fee for Impounds
  • Fixed a few Bugs
  • Added Park In and Park Out functions to unencrypted files
1 Like

Update v1.6

➥ You can now use Custom License plates like “CUSTOM”

Before you had to use “ABC 123”, now you can just use “ABC”.

1 Like

Update v1.7

  • You can now select the vehicle that you want to park in
  • Made a few changes with jobs (read the comments in config.lua)
  • Fixed some bugs with jobs and specified Garages

Update v1.7.1

  • Added Changelogs in VersionChecker
  • Fixed Bug that the Garage always says Vehicle already parked out
  • Fixed Bug when park in the Vehicle and the Garage Job identifier is set to society

Update v1.7.2

  • Added Custom Banner for NativeUI
  • Fixed DeleteVehicleOnServer at Impound that the old vehicle won’t be deleted

Update v1.8

  • Several Bugfixes
  • Improved serverside performance
  • Added lots of Garages
  • AdvancedParking is now optional (but you lose feature without it)
  • You can set your Default Garage in config
  • You can set multiple vehicles categories for each garage/impound
  • You can set the max Distance to park-in your vehicles
  • You can set the view distance for PEDs and Markers
  • You can deactivate the Impounds completely
  • Fixed NPC issue that the NPCs don’t show up sometimes
  • A few more things…
1 Like

Update v1.9

  • Fixed Job Garage if Config.Parking = 'all'
  • Added functions for Custom TextUIs
1 Like

Update v2.0

  • Some little Bugfixes
  • Fixed that you can park-in job vehicles at public garages
  • Changed that you can park-out every vehicle at Impound including job vehicles
1 Like

Update v2.1

  • Some little Bugfixes
  • Fixed that you can park-in a car at heli garages
  • Added that you can parkout a vehicles at the impound if you have a key (Config.parkoutWithKey)

Update v2.2

  • Some little Bugfixes
  • Fixed Bug with Fuel and added more fuel scripts to config.lua
  • Added compatibility for Jaksam Vehicle Keys
  • You can add your own Vehicle Key Script to server_vehiclekeys.lua