[FREE] [qb] Triangulation

History / Information

This is a script that was left sitting after a project that never took off. I have adjusted the script to make it a bit more user-friendly. This is also why it’s not made for multiple frameworks. Initially, this script was meant to serve as a base for exports from other scripts. Some of the base exports remain in the script and can still be utilized for your own purposes.

If you are curious about some of the initial intentions, click below for examples. This is for those who like ideas to recreate on their own.

Click here to view examples.
  • Radio usage
    • Determine the range of radios.
local hits = lib.callback.await("rb-triangulation:cb:triangulatePlayer", false, cid)

if hits < 1 then
    if IsPlayerConnectedToRadio(player) then
        -- Make radio static
    end
end

  • Intercept text messages
    • Hackers can intercept the latest text messages from other players who are located within the same mast/coverage.
local playersWithinCoverage = exports["rb-triangulation"]:GetPlayersInPlayerMastCoverage()

if playersWithinCoverage and next(playersWithinCoverage) then
    for _, cid in pairs(playersWithinCoverage) do
        -- Continue building a list.
        -- Select a cid.
        -- Grab their latest text message.
    end
end

  • Broadcast system
    • Send signals/sounds/music from the base of the masts to players within coverage. Similar code to the above, with some adjustments to the callback.


How does it work?

Masts are created from the config using coordinates. Each mast consists of three props that the script spawns at those coordinates. Every mast has a defined radius, which is the core concept of this script. The more mast radiuses you are within, the more accurate your position becomes.

If you prefer continuous tracking after a hack rather than a single tracking point, switch TrackPlayer to TrackPhoneContinuously under the related event. See exports for more information.

  • The masts break down randomly, and after a hack.
  • To prevent excessive use, there’s a cooldown after a hack/repair.
  • Tracking a player doesn’t return an exact location; the coordinates are scrambled within the tracking radius.
  • Logs are stored for each mast regarding hacks/repairs, including the time.
  • There’s no database related to this script. Masts are restored after a server restart.
  • Cannot track a player if they do not have a phone in their possession.

Features

  • Criminal
    – The masts can be hacked and used to track other players if they know their phone number.
    – After a hack, the mast gradually breaks down. Once it reaches a certain level of damage, it can no longer be used until it is repaired.

  • Police
    – When a mast is being hacked, a dispatch notification can be sent upon request.
    – Exports can be used for the police to track other players.

  • Civilian
    – Anyone can repair a mast.
    – Payment occurs instantly after a repair.


Showcase

Pictures




The player is somewhere within the red circle.

Blips with radiuses when debug is on.


Requirements

  • qbcore
    – Searching for the phone numbers in metadata
    – Payment on repair

  • ox_lib
    – Loading models
    – Context menu
    – Callbacks

  • ox_target
    – Interaction for the props


Download

Github
Documentation/Exports

Psst.

Yes, I know that this isn’t tailored to most people’s setup, but hey… It’s free, and it’s a base that you can adjust and improve for your own project. Smileyface.

The only thing I ask for with re-releases is credit and that they not be sold. Other than that, go crazy.

12 Likes