Incidents
Here, you'll find key exports for managing incidents. These exports allow you to create, update, and delete incidents as needed.
Type
type Incident = {
id: number,
name: string,
description: string, // stringified JSON
vehicles: string[],
evidences: number[],
players: {
identifier: string,
name: string
}[],
victims: {
identifier: string,
name: string
}[],
cops: {
identifier: string,
name: string
}[],
charges: {
list: { id: number, name: string }[],
reduction: {
fine: 50,
jail: 70
},
amount: {
fine: 15000,
jail: 60
}
},
createdAt: string
}
Exports
Search for an incident
-- It returns the incident data
exports['redutzu-mdt']:SearchIncident(id)
local incident = exports['redutzu-mdt']:SearchIncident(1)
print(incident.name)
Create an incident
-- It returns the id of the created incident
exports['redutzu-mdt']:CreateIncident(data, sender)
RegisterCommand('createIncident', function(source)
exports['redutzu-mdt']:CreateIncident({
name = 'Incident Name',
description = '[]',
players = { 'identifier' },
victims = { 'identifier' },
cops = { 'identifier' },
vehicles = { 'plate' },
evidences = { 1, 5 },
charges = {
list = { 2, 4, 8 },
amount = { fine = 15000, jail = 50 },
reduction = { fine = 35, jail = 80 }
}
}, source)
end, false)
Update an incident
-- It returns a boolean (if it was successfully updated)
exports['redutzu-mdt']:UpdateIncident(id, data)
local success = exports['redutzu-mdt']:UpdateIncident(1, {
name = 'Updated Incident',
vehicles = { 'XYZ987' }
})
if not success then
print('There was an error updating the incident')
return
end
print('Incident updated')
Delete an incident
-- It returns a boolean (if it was successfully deleted)
exports['redutzu-mdt']:DeleteIncident(id)
local success = exports['redutzu-mdt']:DeleteIncident(1)
if not success then
print('There was an error deleting the incident')
return
end
print('Incident deleted')
Last updated