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["your_resource_name"]: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 tempShotCoords is a temporary global variable used internally.

  • Works well with scripts that listen for weapon fire and send reports to law enforcement or log systems.


Last updated