[HELP] DrawMarker

Hi,
I have a problem using this native : DrawMarker(type, posX, posY, posZ, dirX, dirY, dirZ, rotX, rotY, rotZ, scaleX, scaleY, scaleZ, colorR, colorG, colorB, alpha, bobUpAndDown, faceCamera, unknown, rotate, *textureDict, *textureName, drawOnEnts)
I can’t make it work…

Here’s my script :
RegisterServerEvent(‘playerSpawned’)
AddEventHandler(‘playerSpawned’, function(spawn)
Citizen.CreateThread(function()
Citizen.Wait(0)
DrawMarker(0, 117.14, -1950.29, 20.7513, 117.14, -1950.29, 20.7513, 0, 0, 0, 1, 1, 1, 55, 255, 55, 255, 0, 0, 0, 0)
end)
end)

Thanks in advance for any help !

2 Likes

@OhMyM DrawMarker is a native use it Clientside!
Looks like you use it Serverside but this isn’t possible

1 Like

I modified to this :
RegisterNetEvent(“playerSpawned”)
AddEventHandler(“playerSpawned”, function()
Citizen.CreateThread(function()
Citizen.Wait(0)
DrawMarker(0, 117.14, -1950.29, 20.7513, 117.14, -1950.29, 20.7513, 0, 0, 0, 1, 1, 1, 55, 255, 55, 255, 0, 0, 0, 0)
end)
end)

And I got this error : A client tried to send an event of type onPlayerConnect, but it was not greenlit for client invocation. You may need to call RegisterServerEvent from your script.

My server is hosted on my own pc

@OhMyM better you post your hole script
because this is an error which is trigger by a false event you trigger from client to server

There are 2 kinds of scripts for your resource

client_script ‘YOUR_CLIENZSCRIPTNAME.lua’

server_script ‘YOUR_SERVERSCRIPTNAME.lua’

This code goes into your Client.lua

Citizen.CreateThread(function()
while true do
Wait(0)
DrawMarker(0, 117.14, -1950.29, 20,7513, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.75, 0.75, 0.75, 204, 204, 0, 100, false, true, 2, false, false, false, false)
end
end)

What do you mean with Client.lua ? Thanks anyway :slight_smile:

@OhMyM It’s a clientside native. Here you get the basics of scripting: https://kanersps.pw/fiverebornwiki/#Basic%20Scripting

So in my resources folder I added a “jobs” folder inside I created :

  • “__resource.lua” with this : client_script ‘client.lua’
  • “client.lua” with this :

Citizen.CreateThread(function()
while true do
Wait(0)
DrawMarker(0, 117.14, -1950.29, 20,7513, 0.0, 0.0, 0.0, 0, 0.0, 0.0, 0.75, 0.75, 0.75, 204, 204, 0, 100, false, true, 2, false, false, false, false)
end
end)

But it still doesn’t work :confused: I still go this error : A client tried to send an event of type onPlayerConnect, but it was not greenlit for client invocation. You may need to call RegisterServerEvent from your script.
And I don’t understand why I should call a ServerEvent if it’s client sided…

Do you have any other scripts running? Is there anything else in the client.lua?

Yeah I’ve got many other script runing (remove peds & vehicles, welcome message, loading screen, etc)
And no there is nothing else in client.lua

@OhMyM I guess it’s for the Welcome Message script. Because you have something with “OnPlayerConnect” wich is causing this message.

1 Like

I disabled all scripts and leaved mine alone but now when I open the map it crash…
And the marker won’t appear

If you are using FiveRebornEnhanced Trainer you cannot use the Map. The game will crash.

Check the coordinates for the Marker it won’t appear on the map. For a map marker you need to create a blimp.

Did someone found a way to draw markers in LUA?

ehmmmm… that’s how @OhMyM have done it? I’m not sure how to answer to this. Just use the native function in a client script xD

i just noticed that i answered a 3 years old post LOL

2 Likes

How to draw or remove marker ,By using admin command?