You’ve got a good start, however there are a few problems with your code.
- When using
while true do
, you must close that with end
like so:
while true do
-- Your code here
end
-
Whenever you use while true do
, make sure to have a Citizen.Wait(0)
somewhere in there. It can be more than 0
if you need that, just make sure to have a wait function in there somewhere or else everyone on the server will crash.
-
When creating blips, you don’t need to loop the blip creation: Once is enough.
-
When creating a blip for a radius, you must set the sprite (type of the marker) to either 4, 9 or 10 as those are the only ones that work with radius blips.
-
When creating a marker in the 3D world, use “DrawMarker”. This will need to be done in a loop though.
Here’s an example:
Citizen.CreateThread(function()
-- Creating and configuring the blip
local blip = AddBlipForRadius(1693.1, 6416.4, 32.59, 50.0)
SetBlipSprite(blip, 9)
SetBlipAlpha(blip, 100)
-- Starting the loop here to create the marker
while true do
DrawMarker(
1, -- Marker type
1693.1, -- Position X
6416.4, -- Position Y
32.59, -- Position Z
0.0, -- Direction X
0.0, -- Direction Y
0.0, -- Direction Z
0.0, -- Rotation X
0.0, -- Rotation Y
0.0, -- Rotation Z
50.0, -- Scale X
50.0, -- Scale Y
5.0, -- Scale Z
255, -- Color Red
255, -- Color Green
255, -- Color Blue
255, -- Alpha channel (transparency)
false, -- Bob up and down
false, -- Face the camera
2, -- Doesn't seem to matter, usually set to 2
false, -- Rotate
nil, -- Texture dictionary
nil, -- Texture name
false -- Draw on other entities
)
Citizen.Wait(0)
end
end)
By the way, you don’t have to use a new line for each value in “DrawMarker” (or any function for that matter). I just like doing it this way because I can easily see what value does what. This is perfectly fine too:
DrawMarker(1, 1693.1, 6416.4, 32.59, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 50.0, 50.0, 5.0, 255, 255, 255, 255, false, false, 2, false, nil, nil, false)