Skip to main content

Server Exports

Below is a list of exports that can be used to interact with the police tablet from other resources.

Fleet Management

You initialize the Fleet Management exports by calling exports["omik_polititablet"]:FleetManagement().

local FleetManagement = exports["omik_polititablet"]:FleetManagement()

FleetManagement.GetRoles()

Get all roles and their assigned officers.

local roles = FleetManagement.GetRoles()

Returns a table with the role name as key and an array of officers as value.

{
[role: string]: {
officer_id: number
badge_number: string
name: string
patrolNumber: string
status: string
}[]
}

FleetManagement.Join(role, officer)

Add an officer to a role. If the role does not exist, it will be created.

FleetManagement.Join("xxxRole", {
officer_id = 1,
badge_number = "123",
name = "John Doe",
patrolNumber = "123",
status = "on-duty"
})

FleetManagement.Leave(role, officer)

Remove an officer from a role.

FleetManagement.Leave("xxxRole", {
officer_id = 1,
badge_number = "123",
name = "John Doe",
patrolNumber = "123",
status = "on-duty"
})

FleetManagement.Link(role, linkOfficer, officer)

Link an officer to another officer. This will assign the officer the same role and patrol number as the linked officer.

linkOfficer is the officer that the officer will be linked to.

FleetManagement.Link("xxxRole", {
officer_id = 1,
badge_number = "123",
name = "John Doe",
patrolNumber = "123",
status = "on-duty"
}, {
officer_id = 2,
badge_number = "456",
name = "Jane Doe",
patrolNumber = "456",
status = "on-duty"
})

FleetManagement.Update(role, newRole, officer)

Update an officers role and data.

FleetManagement.Update("aRole", "bRole", {
officer_id = 1,
badge_number = "123",
name = "John Doe",
patrolNumber = "456",
status = "on-duty"
})

FleetManagement.Reset(officer)

Reset all of the fleet management data but keep the roles.

officer is optional. It will be sent in the omik_polititablet:server:fleetReset event to tell who triggered the reset.

FleetManagement.Reset()

FleetManagement.Reset({
officer_id = 1,
badge_number = "123",
name = "John Doe",
patrolNumber = "456",
status = "on-duty"
...
})

FleetManagement.GetOfficer(officer_id)

Get an officer by their officer_id.

local officer = FleetManagement.GetOfficer(1)

Returns the officer object.

{
role: string
officer: {
officer_id: number;
badge_number: string;
name: string;
patrolNumber: string;
status: string;
}
}

Tablet Config

You initialize the Config exports by calling exports["omik_polititablet"]:Config().

local Config = exports["omik_polititablet"]:Config()

Config.Get()

Get the current config data.

local data = Config.Get()
print(json.encode(data))

Config.Update(data)

Update the config data.

It is important you supply the full config data, not just the data you want to update.

I recommend you get the current config data with Config.Get() and then update the data you want to change.

local data = Config.Get()
print(json.encode(data))

-- Change the data then update config

Config.Update(data)