SaveShootingCoords
When using instanced interiors (like shells), weapon fire detection can break due to mismatched world coordinates. This export allows you to temporarily store the correct entrance coordinates when a player teleports, ensuring accurate detection of where shots are fired, especially for law enforcement (PD) systems.
๐ค Export Usage
Add this on the client side before and after teleporting to or from a shell/interior.
exports["kartik-mdt"]:SaveShootingCoords(true) -- Store the current world coords
-- Do your teleportation or shell loading logic here
exports["kartik-mdt"]:SaveShootingCoords(false) -- Clear it once done (optional)โ When to Use
- Before teleporting to an interior/shell โ store the entrance coordinates.
- After exiting an interior โ optionally reset the stored data.
- Ensures that shooting reports, gunfire detection, and PD alerts use the correct world coordinates.
๐ก Example Integration
RegisterNetEvent("enterDrugLab", function()
-- Save the shooting coords before teleport
exports["kartik-mdt"]:SaveShootingCoords(true)
-- Teleport player to the interior
SetEntityCoords(PlayerPedId(), vector3(1088.6, -3187.6, -39.0))
-- Optionally set a delay or do SaveShootingCoords(false) when exiting
end)๐ง Notes
- The
tempShotCoordsis a temporary global variable used internally. - Works well with scripts that listen for weapon fire and send reports to law enforcement or log systems.