Kartik Scripts

Migrating from JG Garages

Garages V2 can import a server running jg-advancedgarages: every JG garage becomes a kartik garage, and every vehicle ends up in the garage JG had it in. It reads straight from your database, so there is nothing to export.


๐Ÿ“ฆ What Gets Migrated

JGGarages V2
Garage locations (garage_locations)Garages with the same name, type, owner, blip and parking spots
Public, job, gang and impound garagespublic, job, gang and impound garages
Purchased or for-sale garagesprivate garages, owned or listed for sale
car / air / sea garagesCars, bikes & trailers / helicopters & planes / boats & submarines
Job garages showing owned vehiclesShared job garages
Vehicle's garage (garage_id)Vehicle's garage
Job vehicles (job_vehicle)Job-owned vehicles
Job vehicle rank (job_vehicle_rank)<Job> - Grade X+ access groups
Impounded vehiclesStay impounded, at the matching impound lot

Garage Zones

JG garages are a point with a radius; kartik garages are a zone. The migration draws the zone around the JG radius and every parking spot, so each spot is always inside the zone, even where JG's spawn point sat outside its radius. JG garages that already use a polygon keep their exact points.

What Does Not Carry Over

These have no equivalent and are listed in the report so nothing is dropped silently:

  • JG interiors, per-garage marker styles and blip scale.
  • JG-only vehicle rules: infinite spawns, pooled vehicles and spawner garages.
  • Grade limits on a JG garage itself (vehicle ranks do carry over).
  • Gang vehicles stay with their owner, as Garages V2 has no gang-owned vehicles.

๐Ÿš€ Running the Migration

Back up your database first, and stop jg-advancedgarages. The migration refuses to write while it is running, as both scripts would overwrite each other's changes.

  1. Start kartik-garages once so its tables are created.
  2. In the server console, run migratejg. This is a dry run: it prints exactly what would happen and writes nothing.
  3. Check the report, especially vehicles in missing JG garage (see Fallback Garage).
  4. Run migratejg run.
  5. restart kartik-garages to load the new garages.
CommandDescription
migratejgDry run. Prints the full report, changes nothing.
migratejg runImports the garages and moves the vehicles.
migratejg rollbackPuts every migrated vehicle back as it was and removes the imported garages and access groups.

All three run from the server console only.

Running migratejg run again is safe: garages and vehicles that were already migrated are skipped. Garages that already exist in Garages V2 under the same name (ignoring case) are not created twice; their vehicles are pointed at the existing one.


๐Ÿ›Ÿ Safety

  • Backup before every change: each vehicle's old values are saved in kartik_jg_backup before it is touched, which is what rollback restores.
  • Batched: vehicles are moved 500 at a time, each batch in one transaction, so large servers do not stall.
  • JG data is never deleted: JG's tables and columns stay as they are. Drop them yourself once you are happy.

๐Ÿงญ Special Cases

Fallback Garage

A vehicle can point at a JG garage that no longer exists, for example one that was renamed or deleted. Such vehicles go to the first of:

  1. fallbackGarage from the config, when set.
  2. The vehicle's current Garages V2 garage, if it exists.
  3. Config.DefaultGarage.
  4. JG's own default garage (the default of its garage_id column, usually Legion Square).

Vehicles Out When JG Stopped

Vehicles that were out in the world are no longer there once the server is stopped. By default they are put back in their garage, stored, at no cost (outVehicles = "store").

Job Vehicle Ranks

For each job and rank above 0, the migration creates an access group such as Police - Grade 5+, owned by the job, with every grade from that rank upwards ticked, and puts the matching vehicles in it. Rank 0 vehicles stay open to the whole job. Bosses can edit these groups like any other. See Access Groups โ†’ Job Vehicles.


โš™๏ธ Configuration (shared/migration_config.lua)

Config.JGMigration = {
    enabled = true,
    blockingResources = { "jg-advancedgarages" }, -- Refuses to run while these are started
    locationsTable = "garage_locations",

    importDisabled = false,
    fallbackGarage = nil,         -- For vehicles whose JG garage is gone (nil = current garage, Config.DefaultGarage, then JG's default)
    fallbackImpound = nil,        -- nil = first impound lot
    outVehicles = "store",        -- "store" | "impound" | "keep"
    rankGroups = true,            -- JG job_vehicle_rank -> "<Job> - Grade X+" access groups

    zone = {
        segments = 12,
        spawnPadding = 3.0,       -- Metres around each parking spot kept inside the zone
        minHeight = 4.0,
    },

    vehicleTypes = {              -- JG vehicle_type -> kartik vehicle types
        car = { "automobile", "bike", "trailer" },
        air = { "heli", "plane" },
        sea = { "boat", "submarine" },
    },

    batchSize = 500,
}
OptionDescription
importDisabledAlso import garages that are disabled in JG. Vehicles in disabled garages otherwise go to the fallback garage.
outVehiclesstore puts them back in their garage. impound sends them to the impound lot with Config.ImpoundPrice. keep leaves them out for Config.RestartImpoundMode to handle.
rankGroupsSet to false to leave job vehicle ranks out; the vehicles are then open to the whole job.
zone.spawnPaddingExtra room around each parking spot, so a vehicle on the edge spot is fully inside the zone.

On this page