Jump to content

Função attachElements


Recommended Posts

Posted
function createRandomTrash()
	if old then
		if marker and isElement(marker) then
			local attachedElemensts = getAttachedElements(marker)
			if not attachedElemensts then return end
			for k, v in ipairs(attachedElemensts) do
				destroyElement(v)
			end
			destroyElement(marker)
		end
	end
	
	startTime = getRealTime()
	old = current or 1
	current = math.random(1,#lixos)
	
	local mx, my, mz = lixos[current][1],lixos[current][2],lixos[current][3]
	marker = createMarker(mx, my, mz-1, "cylinder", 12, 255, 255, 255, 0)
	createBlipAttachedTo(marker, 41)
	
	local trashObject = createObject(1230, mx, my, mz, 270)
	local trashObject2 = createObject(1230, mx+1, my+3, mz, 270)
	local trashObject3 = createObject(1264, mx+1, my, mz, 270)
	local trashObject4 = createObject(1264, mx-1, my, mz, 270)
	attachElements(trashObject, marker)
	attachElements(trashObject2, marker)
	attachElements(trashObject3, marker)
	attachElements(trashObject4, marker)
	local markerArrow = createMarker(mx, my, mz,"arrow", 1.5, 255, 240, 0, 150)
	attachElements(markerArrow, marker, 0, 0, 6)
	
	local px, py, pz = getElementPosition(localPlayer)
	local dist = math.floor(getDistanceBetweenPoints3D(mx, my, mz,px, py, pz))
	timeLeft = setTimer(onClientFaillJob,dist*200,1)
end

Quando uso a função attachElements com o objeto no marker, o objeto não aparece.

Posted (edited)

Tente com apenas um object sendo anexado. Faça um teste anexando só 1 elemento pra ver se funciona, comente a linha 30 e deixe só 1 object. Certifique-se também que os elementos (objets e a marker foram criados sem erros).

Edited by DNL291

Please do not PM me with scripting related question nor support, use the forums instead.

Posted
12 minutes ago, DNL291 said:

Tente com apenas um object sendo anexado. Faça um teste anexando só 1 elemento pra ver se funciona, comente a linha 30 e deixe só 1 object. Certifique-se também que os elementos (objets e a marker foram criados sem erros).

Testei anexando só um object, ainda não aparece

Posted

Eu testei com um trecho pequeno do seu código e o object aparece, mas grudar ele na marker acho que não funciona com markers; se você fizer ao contrário (marker no object) vai funcionar o attachment. Se ainda tiver alguma dificuldade pra corrigir, será melhor você explicar o que quer fazer pra tentarmos outras formas.

Please do not PM me with scripting related question nor support, use the forums instead.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...