[REQUEST] How create mark, zone?


#1

Hi,

Since this morning, I try to create a zone. For exemple, when I walk on a menu come. (I’ve already the menu).

But my zone doesn’t create. I tried a simple mod with just a client.lua & resource.lua.

This is my client :

local emplacement = { ['x'] = -1228.67517089844, ['y'] = -773.912536621094, ['z'] = 18.4468517303467 }, }

Citizen.CreateThread(function()

	Citizen.Wait(0)
	local pos = GetEntityCoords(GetPlayerPed(-1), false)
	for _,d in ipairs(emplacement)do
		-- if Vdist(d.x, d.y, d.z, pos.x, pos.y, pos.z) < 20.0 then
			-- DrawMarker(1,d.x, d.y, d.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, 1.5, 1.5, 178, 236, 93, 155, 0, 0, 2, 0, 0, 0, 0)
		-- end
		if GetDistanceBetweenCoords(GetEntityCoords(GetPlayerPed(-1)), d.x, d.y, d.z, true) < 20.0 then
			DrawMarker(1,d.x, d.y, d.z, 0.0, 0.0, 0.0, 0.0, 0.0, 0.0, 1.5, 1.5, 1.5, 178, 236, 93, 155, 0, 0, 2, 0, 0, 0, 0)
		end
		
		if(Vdist(d.x, d.y, d.z, pos.x, pos.y, pos.z) < 1.0)then
			DisplayHelpText("Click on ~INPUT_CONTEXT~ for enter in menu")
		end

	end
end)

This is don’t work …

However I understood that :

  • Blip is icons for the map
  • DrawMarker is that zone what I want

Could you help me ? Or just take tips ?
I don’t find tutoials for this.

I’m close but I must forget a little bit :frowning:

Thank you :slight_smile:


#2

Is your main issue… This code shouldn’t even run on the client, you should be getting a syntax error. Add an extra bracket at the beginning of the table and it should work.

local emplacement = { { ['x'] = -1228.67517089844, ['y'] = -773.912536621094, ['z'] = 18.4468517303467 }, }

Also, if this doesn’t exist (you haven’t created the function) you’ll also get errors.


#3

Is your main issue… This code shouldn’t even run on the client, you should be getting a syntax error. Add an extra bracket at the beginning of the table and it should work.

For emplacement syntax -> Ok, i’m so bad lel

When you say : “This code shouldn’t even run on the client”. Why ?
I see a lot of mods and method DrawMaker is always use in client.

Here I won’t create all makers on server but just create when player approaches.

Also, if this doesn’t exist (you haven’t created the function) you’ll also get errors.

I had create this but since I replace it by : GetDistanceBetweenCoords

Also with bracket, that don’t work. I forget something but what … I don’t fine.


#4

I was referring to the missing bracket (the Lua code shouldn’t be interpreted because of it)

Are you getting errors in the console (F8)? If so, they should help you find the problem :slight_smile: