Kartik Scripts

Server Exports

Use these exports to interact with the garage system from other server-side scripts.

Player Data Exports

GetPlayerData

Returns formatted player data for a specific source.

local PlayerData = exports['kartik-garages']:GetPlayerData(source)

GetPlayerByCitizenId

Returns data for an online player by their citizen ID.

local PlayerData = exports['kartik-garages']:GetPlayerByCitizenId("CITIZEN1")

GetOfflinePlayerByCitizenId

Returns data for a player by their citizen ID, even if they are offline.

local PlayerData = exports['kartik-garages']:GetOfflinePlayerByCitizenId("CITIZEN1")

Banking & Transactions

AddPlayerBank

Adds money to a player's bank account.

exports['kartik-garages']:AddPlayerBank(citizenId, amount, "Reason")

RemovePlayerBank

Removes money from a player's bank account.

exports['kartik-garages']:RemovePlayerBank(citizenId, amount, "Reason")

AddPlayerCash

Adds cash to a player.

exports['kartik-garages']:AddPlayerCash(source, amount, "Reason")

RemovePlayerCash

Removes cash from a player.

exports['kartik-garages']:RemovePlayerCash(source, amount, "Reason")

Vehicle Management

InsertVehicleIntoDB

Manually inserts a vehicle into the player_vehicles table.

exports['kartik-garages']:InsertVehicleIntoDB(license, citizenId, model, props, plate)

fetchPlate

Checks if a plate already exists in the database.

local plate = exports['kartik-garages']:fetchPlate("ABC 123")

Job Owned Vehicles

See Job Owned Vehicles for how ownership is stored and what the registered keeper is.

PurchaseJobVehicle

The entry point for a dealership. Files a vehicle under a job, inventing a free plate when you have none. Returns ok, plate | error message.

local ok, plate = exports['kartik-garages']:PurchaseJobVehicle({
    job = 'police', model = 'police3', buyer = Player.citizenid, price = 45000,
})

AddJobVehicle

Creates a job vehicle directly. citizenId is the registered keeper and is required unless a fallback keeper is set.

local ok, plate = exports['kartik-garages']:AddJobVehicle(jobName, model, plate, citizenId, garageName, props)

GetVehicleJobOwner

Returns the job that owns a plate, or nil when it is personally owned.

local jobName = exports['kartik-garages']:GetVehicleJobOwner("ABC 123")

SetVehicleJobOwner

Hands an existing vehicle over to a job.

exports['kartik-garages']:SetVehicleJobOwner("ABC 123", "police")

ClearVehicleJobOwner

Moves a job vehicle back to a person. Pass no citizen id to leave it with the existing keeper. Refuses vehicles that are not job-owned.

exports['kartik-garages']:ClearVehicleJobOwner("ABC 123", "CITIZEN1")

RemoveJobVehicle

Deletes a job vehicle. Refuses vehicles that are not job-owned.

exports['kartik-garages']:RemoveJobVehicle("ABC 123")

GetJobVehicles

Returns the job's whole fleet.

local vehicles = exports['kartik-garages']:GetJobVehicles("police")

GetJobKeeperCitizenId

Returns the fallback registered keeper currently in effect, or nil.

local keeper = exports['kartik-garages']:GetJobKeeperCitizenId()

Utility Exports

GetCopCount

Returns the current number of police officers online and on duty.

local policeCount = exports['kartik-garages']:GetCopCount()

GetGroupMembers

Returns a list of members for a specific gang/group.

local members = exports['kartik-garages']:GetGroupMembers("ballas")

On this page