[HELP]Make blip on map to make something happen

Basically, just check the distance between 2 coords (the players and the blips) and if its below lets say 5 then do something

Ok i am going to do kiind of an example see if it works

Just asking can I use a native to get the coords or just create variable with coords?

You would need to get the distance for the player to do something on the marker. Is this a Blip or a Marker?

Marker think like you go to pd say and there will be like a thing there you go to and menu pops up. Like I am new to programming with gtav I learnt the basics of lua like the function if else while etc

local table = {
	{x = 1,y = 1,z = 1},
	{x = 2,y = 2,z = 2},
	{x = 3,y = 3,z = 3}
}

-- Draw Markers --
Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)
		for k in pairs(table) do
			-- Draw Marker Here --
			DrawMarker(1, table[k].x, table[k].y, table[k].z, 0, 0, 0, 0, 0, 0, 1.001, 1.0001, 0.5001, 0, 0, 255, 200, 0, 0, 0, 0)
		end
	end
end)

Citizen.CreateThread(function()
	while true do
		Citizen.Wait(0)

		for k in pairs(table) do

			local plyCoords = GetEntityCoords(GetPlayerPed(-1), false)
			local dis = Vdist(plyCoords.x, plyCoords.y, plyCoords.z, table[k].x, table[k].y, table[k].z)

			if dist <= 1.2 then
				if IsControlJustPressed(3,176) then
					Citizen.Trace("BUTTON ENTER PRESSED ON MARKER.")
				end
			end
		end
	end
end)
1 Like

Thanks but Could you explain little more about how I would do the marker

I put markers in comments up there…

Yes I mean I dont really understand exactly what you mean but thanks for the help so if you cant tel me its fine ill figure it out but it would help a lot if you could

Thats litterally a full script… That copy and past would work. Just need to fill the XYZ coords in the table.

Oh ok thanks I will take this and learn from it thanks

Also do i put the coords in the variable or the draw marker just checking incase i do it wrong lol

local table = {
	{x = 1,y = 1,z = 1},
	{x = 2,y = 2,z = 2},
	{x = 3,y = 3,z = 3}
}

Ok thanks This will help me learn to script a lot more thanks

Where it says Citizen.trace("Button…)
Under that is where i put what i want it to do right?

Yes. It is where you would put your code.

It dont seem to be working i put a notifaction there but it didnt work ill show you now

Ignore the 2 other screens but look at the mioddle screen

Alright first why do you have a function inside of a function? Second where are you getting playerName from? Third did you fill out your own XYZ coords and see if it prints out “BUTTON PRESSED or whatever”…???