This release is a trackify replacement. In case you do have not played GTA: Online or GTAV, it is a cellphone app that tracks the position of an entity (Player, Civilian, Vehicle, etc.) in the world and instead of displaying a symbol on the map you just get a red dot on your phone and if you travel towards the red dot on your phone you will ultimately meet that entity. See the merged screenshots below. The image is made with scaling set to "LOG"
.
Sample Implementation
targetsEntity = {}
spawnPos = {{-397.80331420898,-2164.9846191406,15.8256015777588},{1227.6180419922,2719.5869140625,40.005180358887}}
stuffSpawned = false
Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if IsControlJustReleased(1,213) then -- home key
if not stuffSpawned then
local vhash = GetHashKey('boxville')
local dhash = GetHashKey('s_m_y_airworker')
RequestModel(vhash)
while not HasModelLoaded(vhash) do
Citizen.Wait(1)
end
local v1 = CreateVehicle(vhash, spawnPos[1][1],spawnPos[1][2],spawnPos[1][3], 0.0, true, false)
local v2 = CreateVehicle(vhash, spawnPos[2][1],spawnPos[2][2],spawnPos[2][3], 0.0, true, false)
SetVehicleOnGroundProperly(v1)
SetVehicleOnGroundProperly(v2)
RequestModel(dhash)
while not HasModelLoaded(dhash) do
Citizen.Wait(1)
end
local d1 = CreatePedInsideVehicle(v1, 4, dhash, -1, true, 0)
local d2 = CreatePedInsideVehicle(v2, 4, dhash, -1, true, 0)
TaskVehicleDriveWander(d1, v1, 20.0, 536871299)
TaskVehicleDriveWander(d2, v2, 20.0, 536871299)
stuffSpawned = true
table.insert(targetsEntity,v1)
table.insert(targetsEntity,v2)
TriggerEvent('mtracker:settargets', targetsEntity)
end
TriggerEvent('mtracker:start')
end
end
end)
This script spawns two boxvilles of the LS Department of Water and Power who drive around randomly through the world. I think the AI script only truely triggers when you are close enough to them, but it is good enough to understand the workings of the app.
How to use the App
Configure with the cfg.lua
should be self explanatory. The default settings work with the current implementation. Use the following client events to use the application:
- Call
mtracker:settargets
to set target entities, like vehicles, players or whatever you like, it has to be an entity. (Ped / Vehicle / Object) - Use
mtracker:start
andmtracker:stop
to start and stop the app. - Use
mtracker:removealltargets
to remove all targets. - Use
exports.mtracker:isrunning()
to check if the app is running or not.
You can download it from: https://github.com/GHMatti/FiveM-Scripts/tree/master/mtracker
Changelog
- 20180102: Initial Release
- 20180103: Changed isrunning to be an export, as synchronous feedback is needed. Removed an unneeded utility function.
Q&A
- For what can I use the app? Players tracking players (through cellphones?), Missions to find certain vehicles, etc.
- Why do you not use the app_trackify scaleform? All cellphone apps are intrinsically linked to the cellphone scaleform. This means that any data input is handled by the cellphone scaleform instead of the app scaleform. And I just wanted to write my own cellphones.
-
I want to customize it for my own phone implementation, what to do? mtracker automatically scales to your background image. The current image uses
#0060b8
as a background color with a black-transparent grandient on top. The tracker_bar, in case you want to replace this too, is white and uses a#0096ff
shadow, same as the player symbol, which is taken from the original trackify app. You might need to adjust the circle spacing by adjustingvar stepsize = 55;
to a smaller or bigger value intracker.html
. Finally you need to fiddle a bit with the css of the ids:#phone #bgfill #appwrapper
with theright
andbottom
values, and in case of#bgfill
also with thewidth
andheight
to make it look neat.
This is very likely my last release (using lua) as the lua-C# messaging interface is pissing me off due to some kinks it has. I started already migrating most of my stuff to C#, and might release in the future whatever is doable as a standalone release.