I’ve tried the drawMarker function but I don’t believe that it is the correct function as it requires a static location and the marker shown bobs up and down while moving with the entity. Is it an undiscovered native by some chance? It allows to be placed on objects, peds, and vehicles and the color is customisable as well. Any help would be greatly appreciated.
The bobbing up and down is a parameter for drawMarker, same with the color settings. The marker is just drawn at the coords of the vehicle + some offset.
Just an pseudo code how you could achieve that.
CreateThread thread... {
bool markerExist = true
Vector3 offset = new Vector3(0f, 0f, 1f) // base offset to place over the car
while (markerExist && DoesEntityExist ...) {
wait(0)
Vector3 position = GetEntityCoords...
DrawMarker(position + offset ...)
}
}
You literally dont need to reinvent the wheel. As the guy above said. There’s a parameter in DrawMarker() you set to true and it will bounce. Lol
Oh well I didn’t know this
But now i see it’s the param bobUpAndDown
Got it working! Thanks guys!
A little bit about the script. The Merryweather guys in the video were spawned in using the MENYOO trainer. They were also part of the SPOONER_ENEMIES relationship group. For my script I checked every ped in the world to see if they are part of the SPOONER_ENEMIES group…if they were then they get a marker + a blip.
The vehicles are different. I checked if the vehicle was locked for the player, if it was then a marker + a blip would be added. The marker’s position also depends on the type of vehicle it is to avoid clipping issues.
Citizen.CreateThread(function () -- Markers for peds
enemies = GetHashKey('SPOONER_ENEMIES')
while true do
Citizen.Wait(0)
if InMission == true then
for _, ped in ipairs(GetGamePool('CPed')) do
local pedrelation = GetPedRelationshipGroupHash(ped)
if DoesEntityExist(ped) and not IsEntityDead(ped) and pedrelation == enemies then
local pedpos = GetOffsetFromEntityInWorldCoords(ped, 0.0, 0.0, 1.8)
DrawMarker(20, pedpos.x, pedpos.y, pedpos.z, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 1.0, 1.0, 1.0, 255, 0, 0, 50, 1, 1, 2, 0, 0)
end
end
end
end
end)
Citizen.CreateThread(function () -- Markers for vehicles
while true do
Citizen.Wait(0)
if InMission == true then
for _, veh in ipairs(GetGamePool('CVehicle')) do
local doorstatus = GetVehicleDoorLockStatus(veh)
if DoesEntityExist(veh) and not IsEntityDead(veh) and doorstatus == 3 then
if GetVehicleClass(veh) == 15 or GetVehicleClass(veh) == 16 then
local vehpos = GetOffsetFromEntityInWorldCoords(veh, 0.0, 0.0, 3.8)
DrawMarker(20, vehpos.x, vehpos.y, vehpos.z, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 1.0, 1.0, 1.0, 255, 0, 0, 50, 1, 1, 2, 0, 0)
else
local vehpos = GetOffsetFromEntityInWorldCoords(veh, 0.0, 0.0, 2.3)
DrawMarker(20, vehpos.x, vehpos.y, vehpos.z, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 1.0, 1.0, 1.0, 255, 0, 0, 50, 1, 1, 2, 0, 0)
end
end
end
end
end
end)
If you don’t care about any of this but want the marker code, here it is
while true do
local yourentitypos = GetOffsetFromEntityInWorldCoords(yourentity, 0.0, 0.0, 2.3) -- Change 2.3 to your liking (requires trial and error), this is the height at which the marker is above the entity
DrawMarker(20, yourentitypos.x, yourentitypos.y, yourentitypos.z, 0.0, 0.0, 0.0, 0.0, 180.0, 0.0, 1.0, 1.0, 1.0, 255, 0, 0, 50, 1, 1, 2, 0, 0)
end
Scripted in LUA
Please share the solution or mark the helping anwser as solution