forked from Tommy228/tttdamagelogs
-
Notifications
You must be signed in to change notification settings - Fork 23
Handle report status change
Michael Hawkins edited this page Aug 14, 2022
·
5 revisions
When an admin changes the status of a report, a custom event (hook) will be emitted.
This hook may be useful if you wish to log report status changes to Discord.
Hook name: RDMManagerStatusUpdated
Name | Example | Description |
---|---|---|
ply | Player [1][Badger] | The player entity of the admin that changed the report status |
reportId | 1 | The report number. Use this to identify one report from another. Report numbers start again from 1 on map change. |
newStatus | 2 | The new status of the report. 1: Waiting 2: In progress 3: Completed |
isReportFromPreviousMap | true | false = this report is from the current map true = this report is from the previous map |
-- Replace "myaddon" in the two lines below with some unique name for your addon
hook.Remove("RDMManagerStatusUpdated", "myaddon_RDMManagerStatusUpdated")
hook.Add("RDMManagerStatusUpdated", "myaddon_RDMManagerStatusUpdated", function(ply, reportId, newStatus, isReportFromPreviousMap)
local reportStatus = "unknown"
if(newStatus == 1) then reportStatus = "waiting"
elseif(newStatus == 2) then reportStatus = "in progress"
elseif(newStatus == 3) then reportStatus = "completed"
end
local map = isReportFromPreviousMap and "previous map" or "current map"
print(string.format("The admin %s has changed the status of report %d (%s) to %s",
ply:Nick(),
reportId,
map,
reportStatus
))
-- Handle the hook
end)
The admin Badger has changed the status of report 1 (current map) to waiting
The admin Badger has changed the status of report 1 (current map) to in progress
The admin Badger has changed the status of report 1 (previous map) to waiting