[VIDEO TUTORIAL] How to add a custom marker

Hi!
This is my first tutorial, so please dont judge my english or videomaking skills ahaha
In my community many people have asked me to make this video on how to add a custom marker on your server, so I decided to expose it to the whole forum community

Credits: tringuyenk19 (original text guide)

Click here To see the full video on youtube!

 

Click here to download the resource template

17 Likes

hello great job, how would you add the DrawDistance

1 Like

Just for your information, __resource.lua is a deprecated resource manifest and you should be using fxmanifest.lua instead. More information on that is listed here: Resource manifest - Cfx.re Docs

yes I already knew, I needed to do it fast, thanks anyway

just add the check on the distance brother

A little code snippet for people whose ass is as lazy as mine to open OpenIV.

local dobj = CreateDui('LINK OF THE IMAGE', 256, 256)
local duiHandle = GetDuiHandle(dobj)
local dict = CreateRuntimeTxd('marker') -- dictionary name
local txd = CreateRuntimeTextureFromDuiHandle(dict, 'marker', duiHandle) -- texture name

Enjoy it! :slight_smile:

1 Like

thanks for your contribution :heart:

1 Like

How do I add 2 or 3 markers?

Do the same as with the first marker? Just add more textures to the ytd. So stream more textures. If you want to do it in the same ytd, then you just have to specify the texture name in DrawMarker. and otherwise you still have to change the dictionary name.

1 Like

yes, right

1 Like

Thank you! Your answer helped me to get an idea of what I should do, I don’t know if it’s the right one, but it worked.

Code

Citizen.CreateThread(function()
while true do
Citizen.Wait(0)
if not HasStreamedTextureDictLoaded(“marker”) then
RequestStreamedTextureDict(“marker”, true)
while not HasStreamedTextureDictLoaded(“marker”) do
Wait(1)
end
else
DrawMarker(9, -4119.48, 7386.86, 16.49, 0.0, 0.0, 0.0, 0.0, 90.0, 0.0, 1.0, 1.0, 1.0, 255, 255, 255, 255,false, false, 2, true, “marker”, “marker”, false)
DrawMarker(9, -4627.82, 6035.19, 19.74, 0.0, 0.0, 0.0, 0.0, 90.0, 0.0, 1.0, 1.0, 1.0, 255, 255, 255, 255,false, false, 2, true, “marker”, “marker01”, false)
end
end
end)

2 Likes

yea, that’s the right way, how you use it. :slight_smile:

1 Like

Hey, the problem using this method is that the png ain’t transparent, here is an example :

Using an image from here :
https://forum.cfx.re/uploads/default/original/3X/0/3/0301f645963889531fb4870e8d47f2f7da7f1c45.gif

It is a transparent .gif but same result using transparent .png

yee, I know. My friend helped my to fix that by writing a small api, which removes the background of the images in my database.

1 Like

Here is an example. I can write the name of the requested faction as a value in this url
https://scrypth0n.dev/gangland.php?frakname=gazo

if “frakname” is empty, it loads the server-logo. I’ll ask my friend if he may release the php file in the forum.

1 Like

Thanks!

1 Like

can you release php?

I created a seperate post for this

When i add another marker like mentioned above i get this crash

hi i have problem