vms* store - Docs
Purchase Asset
  • Welcome
  • Official Store
  • Discord
  • Helpful
    • Basic Server Knowledge
      • How to import SQL to database?
      • How to update server artifacts?
    • General Issues
    • Prepared Resources
  • ASSETS
    • vms_notifyV2
      • Installation
      • FAQ
      • Guides
        • Text Formatting
        • Swap in framework
      • Developer API
        • Client Exports
        • Server Events
      • Configuration Files
        • config.lua
        • config.js
    • vms_bossmenu
      • Installation
      • Compatibility
      • FAQ
      • Guides
        • Creating job2 on ESX
        • Paychecks Integration
      • Developer API
        • Client Exports
        • Client Events
        • Server Exports
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
    • vms_cityhall
      • Installation
      • Compatibility
      • FAQ
      • Common Errors
      • Guides
        • License Revocation
        • Personal Taxes Integration
        • Business Taxes Integration
        • Paychecks Integration
        • Add SSN Generation
        • Generate SSN for Players
        • Add VIN Generation
        • Generate VIN for Vehicles
      • Developer API
        • Client Exports
        • Server Exports
        • Commands
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.shared.lua
        • config.clerks.lua
        • config.taxes.lua
        • config.js
    • vms_documentsV2
      • Installation
      • FAQ
      • Common Errors
      • Guides
        • Add SSN Generation
        • Generate SSN for Players
        • Creating New Document
        • Driving School Integration
      • Developer API
        • Client Exports
        • Server Exports
        • Commands
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • metadata.js
    • vms_garagesV2
      • Installation
      • Compatibility
        • Housings
          • qs-housing
          • esx_property
          • bcs_housing
        • Phones
          • yflip-phone
          • qs-smartphone-pro
        • Other
          • VehicleDeformation
          • kq_wheeldamage
      • FAQ
      • Common Errors
      • Guides
        • Interior Stuck Prevention
        • Registering House Garage
      • Developer API
        • Client Exports
        • Server Exports
        • Server Events
        • Commands
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.garages.lua
        • config.management.lua
        • config.parkingcreator.lua
        • config.js
    • vms_houserobberies
      • Installation
      • FAQ
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.items.lua
        • config.interiors.lua
        • config.houseslist.lua
        • config.configurator.lua
    • vms_vehicleshopV2
      • Installation
      • Compatibility
      • FAQ
      • Common Errors
      • Guides
        • Adjusting Required Licenses
        • Adjusting orderprice
        • Photos Tool
      • Developer API
        • Client Exports
        • Client Events
        • Server Exports
        • Commands
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.management.lua
        • config.showroom.lua
        • config.js
    • vms_stores
      • Installation
      • Compatibility
      • FAQ
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.camera.lua
        • config.robbery.lua
        • config.storemanage.lua
        • config.js
    • vms_reports
      • Installation
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.js
    • vms_tuning
      • Installation
      • FAQ
      • Common Errors
      • Guides
        • Garage Integration
          • jg-advancedgarages
        • Understanding Prices
        • Using whitelist & blacklist
        • Fix tuning parts names from NULL
        • Paychecks from the built-in balance
      • Developer API
        • Client Exports
        • Server Exports
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.vehicles.lua
        • config.tuningmenu.lua
        • config.installationparts.lua
        • config.custommods.lua
        • config.missions.lua
    • vms_gym
      • Installation
      • FAQ
      • Common Errors
      • Developer API
        • Client Exports
        • Server Exports
        • Server Events
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.management.lua
    • vms_hud
      • Installation
      • FAQ
      • Common Errors
      • Developer API
        • Client Exports
        • Client Events
        • Server Events
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.js
    • vms_spawnselector
      • Installation
      • Compatibility
        • vms_multichars
        • esx_multicharacter
        • esx_identity
        • qb-multicharacter
      • FAQ
      • Developer API
        • Client Exports
        • Server Events
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
    • vms_guidebook
      • Installation
      • Guides
        • Text Formating
      • Developer API
        • Client Exports
        • Client Events
        • Server Events
      • Configuration Files
        • config.lua
        • pages.js
    • vms_coinshop
      • Installation
      • Configuration Files
        • config.lua
    • vms_vehicleshop
      • Installation
      • Configuration Files
        • config.lua
    • vms_gangmissions
      • Installation
      • Guides
        • Connection to NPCTALK
      • Configuration Files
        • config.lua
    • vms_charcreator
      • Installation
      • Compatibility
        • vms_multichars
        • esx_multicharacter
        • esx_identity
        • qb-multicharacter
        • ZSX_Multicharacter
        • renzu_multicharacter
      • FAQ
      • Developer API
        • Client Events
        • Server Events
      • Configuration Files
        • config.lua
    • vms_clothestore
      • Installation
      • Compatibilty
      • Common Errors
      • Developer API
        • Client Exports
        • Client Events
        • Server Events
      • Configuration Files
        • config.lua
        • config.prices.lua
        • config.js
    • vms_multichars
      • Installation
      • Compatibilty
      • Common Errors
      • Developer API
        • Commands
      • Configuration Files
        • config.lua
        • config_client.lua
        • config_server.lua
        • config_commands.lua
    • vms_identity
      • Installation
      • FAQ
      • Common Errors
      • Configuration Files
        • config.lua
    • vms_barber
      • Installation
      • Compatibility
      • FAQ
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.management.lua
    • vms_tattooshop
      • Installation
      • Compatibility
      • FAQ
      • Common Errors
      • Guides
        • New ADD-ON Tattoos
      • Developer API
        • Client Exports
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.management.lua
        • config.tattoos.lua
    • vms_driveschoolV2
      • Installation
      • Compatibility
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
    • vms_boatschoolV2
      • Installation
      • Compatibility
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.routes.lua
    • vms_flightschoolV2
      • Installation
      • Compatibility
      • Common Errors
      • Configuration Files
        • config.lua
        • config.client.lua
        • config.server.lua
        • config.routes.lua
    • vms_documents
      • Installation
      • Guides
        • Adding to radialmenu
        • Usage of documents
        • Adding new documents
      • Configuration Files
        • config.lua
    • vms_anims
      • Installation
      • Guides
        • Adding animations
        • Adding more binds
      • Developer API
        • Client Exports
      • Configuration Files
        • config.lua
        • animations.lua
        • keybinds.lua
    • vms_weaponshop
      • Installation
      • Configuration Files
        • config.lua
    • vms_notify
      • Installation
      • Guides
        • Implementation
        • Replace core notifications
Powered by GitBook
On this page

Was this helpful?

  1. ASSETS
  2. vms_garagesV2
  3. Compatibility
  4. Phones

yflip-phone

  1. Navigate to the path yseries/config/config.garages.lua

  2. Find the Config.Garages option and customize:

Config.Garages = "vms_garagesv2"

  1. Navigate to the yseries/client/apps/framework/garage/

  2. Create file vms_garagesv2.lua inside yseries/client/apps/framework/garage/

  3. Paste the following code into the yseries/client/apps/framework/garage/vms_garagesv2.lua file

yseries/client/apps/framework/garage/vms_garagesv2.lua
CreateThread(function()
    if Config.Garages ~= 'vms_garagesv2' then return end

    debugPrint("Using vms_garagesv2")

    function GetVehicleLabel(model)
        local vehicleLabel = GetDisplayNameFromVehicleModel(model):lower()

        if not vehicleLabel or vehicleLabel == 'null' or vehicleLabel == 'carnotfound' then
            vehicleLabel = 'Unknown'
        else
            local text = GetLabelText(vehicleLabel)
            if text and text:lower() ~= 'null' then
                vehicleLabel = text
            end
        end

        return vehicleLabel
    end

    function FindVehicleByPlate(plate)
        return lib.callback.await('yseries:server:garage:find-vehicle-by-plate', false, plate)
    end

    function MapVehiclesData(vehicles)
        -- * Implement your garage logic here.
        if vehicles then
            for i = 1, #vehicles do
                vehicles[i].vehicle = GetDisplayNameFromVehicleModel(vehicles[i].model):lower()

                vehicles[i].model = GetVehicleLabel(vehicles[i].model)
            end
        end

        return vehicles
    end
end)

  1. Navigate to the yseries/server/apps/framework/garage/

  2. Create file vms_garagesv2.lua inside yseries/server/apps/framework/garage/

  3. Paste the following code into the yseries/server/apps/framework/garage/vms_garagesv2.lua file

yseries/server/apps/framework/garage/vms_garagesv2.lua
CreateThread(function()
    if Config.Garages ~= 'vms_garagesv2' then
        return
    end

    debugPrint("Using vms_garagesv2")
    local database = {
        ['table:owned_vehicles'] = 'owned_vehicles', -- for qb-core: player_vehicles
        ['column:owner'] = 'owner', -- for qb-core: citizenid
        ['column:vehicle'] = 'vehicle', -- for qb-core: mods
        ['column:plate'] = 'plate'

    }
    
    function GetPlayerVehicles(source)
        local vehicles = MySQL.query.await(('SELECT * FROM `%s` WHERE `%s` = ? AND `company` IS NULL'):format(database['table:owned_vehicles'], database['column:owner']), {
            Framework.GetPlayerFromId(source)?.identifier
        })
        
        local vehiclesList = {}
        if not vehicles then
            return nil
        end

        for _, v in pairs(vehicles) do
            local garageLabel, garageCoords = "Out of Garage", nil
            if v.garage then
                garageLabel, garageCoords = exports['vms_garagesv2']:getGarageInfo(v.garage)
                if garageLabel == 'house' then
                    garageLabel = "House" -- You can adjust your language here.
                end
            end

            local currentVehicle = {
                plate = v.plate,
                type = v.type,
                location = garageLabel,
                statistics = {}
            }

            local vehicle = v[database['column:vehicle']] and json.decode(v[database['column:vehicle']]) or nil
            if vehicle then
                if vehicle.fuelLevel then
                    currentVehicle.statistics.fuel = math.floor(vehicle.fuelLevel + 0.5)
                end
                if vehicle.engineHealth then
                    currentVehicle.statistics.engine = math.floor(vehicle.engineHealth / 10 + 0.5)
                end

                if vehicle.bodyHealth then
                    currentVehicle.statistics.body = math.floor(vehicle.bodyHealth / 10 + 0.5)
                end

                currentVehicle.model = vehicle.model or "Unknown Model"
            else
                currentVehicle.model = "Unknown Model"
            end

            vehiclesList[#vehiclesList + 1] = currentVehicle
        end

        return vehiclesList
    end

    function GetVehicle(plate)
        local src = source
        local identifier = Framework.GetPlayerFromId(src).identifier

        local vehicleData = MySQL.query.await(([[
            SELECT garage, garageSpotID, plate, `%s` FROM `%s` WHERE `%s` = ? AND plate = ? AND garage IS NOT NULL AND impound_data IS NULL
        ]]):format(database['column:vehicle'], database['table:owned_vehicles'], database['column:owner']),
            {identifier, plate})
        if not vehicleData or #vehicleData == 0 then
            return nil
        end

        MySQL.query.await(
            ('UPDATE `%s` SET garage = NULL, garageSpotID = NULL, parking_date = NULL WHERE plate = ?'):format(
                database['table:owned_vehicles']), {plate})

        TriggerEvent('vms_garagesv2:vehicleTakenByPhone', vehicleData[1].garage, vehicleData[1].garageSpotID)
        Citizen.CreateThread(function()
            Citizen.Wait(3000)
            local allVehicles = GetAllVehicles()
            for i = 1, #allVehicles do
                if DoesEntityExist(allVehicles[i]) then
                    local vehPlate = GetVehicleNumberPlateText(allVehicles[i])
                    local cleanedPlate = vehPlate:match("^%s*(.-)%s*$")
                    if cleanedPlate == plate then
                        MySQL.query.await(('UPDATE `%s` SET netid = ? WHERE plate = ?'):format(
                            database['table:owned_vehicles']), {NetworkGetNetworkIdFromEntity(allVehicles[i]), plate})
                        break
                    end
                end
            end
        end)

        return vehicleData[1]
    end

    local function IsVehicleOut(plate, vehicles)
        if not vehicles then
            vehicles = GetAllVehicles()
        end

        for i = 1, #vehicles do
            local vehicle = vehicles[i]
            if DoesEntityExist(vehicle) and GetVehicleNumberPlateText(vehicle):gsub('%s+', '') == plate:gsub('%s+', '') then
                return true, vehicle
            end
        end

        return false
    end

    lib.callback.register('yseries:server:garage:get-vehicles', function(source)
        local vehicles = GetPlayerVehicles(source)

        return vehicles
    end)

    lib.callback.register('yseries:server:garage:find-vehicle-by-plate', function(source, plate)
        local out, vehicle = IsVehicleOut(plate)

        if out and vehicle then
            return GetEntityCoords(vehicle)
        else
            local vehicles

            vehicles = MySQL.query.await(('SELECT garage FROM `%s` WHERE `%s` = ?'):format(
                database['table:owned_vehicles'], database['column:plate']), {plate})
            if vehicles and vehicles[1] then
                local garageLabel, garageCoords = exports['vms_garagesv2']:getGarageInfo(vehicles[1].garage)
                return garageCoords
            end
        end
    end)
end)

Last updated 8 months ago

Was this helpful?