Impact Dynamics / Integrations
Dispatch, logs & hooks
server/hooks.lua is your place for reactions to what Impact Dynamics does - a 911 / dispatch call, Discord logs, insurance, paying a tow crew. It stays open when the resource is escrowed.
These events are server-only (clients cannot fire them) and only fire after the server validated the report.
A crash
Lua
AddEventHandler('ryan-impactdynamics:crash', function(src, netId, tier, kmh, coords)
-- src = the driver's server id
-- netId = the vehicle's network id
-- tier = 'light' | 'moderate' | 'heavy' | 'severe'
-- kmh = how hard the hit was: the sudden change in speed, in km/h
-- coords = vector3 of the contact point (the vehicle's position if the reported point was not at the car)
end)
Example: a dispatch call for bad crashes
Lua
AddEventHandler('ryan-impactdynamics:crash', function(src, netId, tier, kmh, coords)
if tier ~= 'heavy' and tier ~= 'severe' then return end
-- replace with your dispatch script's own export / event
exports['my_dispatch']:CreateCall({
title = 'Traffic Collision',
coords = coords,
priority = tier == 'severe' and 1 or 2,
jobs = { 'police', 'ambulance' },
})
end)
!
A rollover is several hits and one crash can be reported 2-3 times as it scrapes on. Add your own cooldown per vehicle (netId) before placing calls. The server passes on at most 8 crashes per player per minute and drops hits on the same vehicle that come less than 450 ms apart.
A jammed door was freed
Lua
AddEventHandler('ryan-impactdynamics:doorFreed', function(src, netId, door, how)
-- door: 0 front left, 1 front right, 2 rear left, 3 rear right
-- how: 'forced' (pry tool), 'kicked' (from inside), 'script' (FreeDoor export)
-- src: the player who did it (0 for 'script')
end)
A debris field was swept
Lua
AddEventHandler('ryan-impactdynamics:fieldSwept', function(src, fieldId, total)
-- src = the player who finished it
-- total = pieces the field had
-- e.g. pay a tow / fire crew for clearing the road
end)
Still stuck? Open a ticket in the Ryan Studios Discord and we'll help you out.