Jump to content

Criando Trabalho (Ajuda não quer sumir o ultimo marker))


Recommended Posts

eai galera to fazendo um trabalho de caminhoneiro aqui mais quando chega no final o ultimo marker n quer funcionar alguem me ajuda!!

 

trabalhar = createMarker ( 2119.4497070313,-2508.9829101563,12.546875 , "cylinder", 3, 255,0,0, 255)
	   


pos = {
        {2078.6047363281,-2493.1494140625,12.546875},
        {2076.603515625,-2486.392578125,12.546875},
		{2072.7844238281,-2504.3322753906,12.546875}
}

final1 = {

        {2120.7470703125,-2498.548828125,12.546875}
}



veh = {}
function pegartrabalho (source)
if isElementWithinMarker (source, trabalhar ) then
if veh[source] and isElement( veh[source] ) then destroyElement(veh[source] )
 veh[source] = nil
 end
  local x,y,z = getElementPosition(source)
 veh[source] = createVehicle(456 ,2111.2795410156,-2499.3354492188,13.546875 + 2)
 warpPedIntoVehicle (source,veh[source])
 outputChatBox ('#000000[#FF3030Trabalho #000000]#FF0000Vá até a bandeira para carregar seu caminhão',source,255,255,255,true)
local v = pos[math.random(1,#pos)]
marker = createMarker(v[1],v[2],v[3],"cylinder",3,28,133,236,200,source)
 addEventHandler( "onMarkerHit", marker ,levar )
 addEventHandler( "onMarkerHit", marker ,destruirElement )
 end
 end
 addEventHandler( "onMarkerHit", trabalhar ,pegartrabalho )
 
 
function destruirElement(source)
if isElementWithinMarker (source, marker ) then
 setElementFrozen(source,true)
 setTimer(function()
 setElementFrozen(source,false)
  destroyElement(marker)
  end,5000,1)
 end
end
  
  
function levar (source)
 if isElementWithinMarker (source, marker ) then
 local v = final1[math.random(1,#final1)]
 final = createMarker(v[1],v[2],v[3],"cylinder",3,28,133,236,200,source)
 addEventHandler( "onMarkerHit", final ,final2 )
 end
 end

function final2 (source)
 if isElementWithinMarker (source, final ) then
 setElementFrozen(source,true)
 setTimer(function()
 destroyElement(final)
 setElementFrozen(source,false)
 destroyElement(veh[source])
 end,5000,1)
end
end

o marker final não quer sumir nao sei oque eu faço

Link to comment
  • Other Languages Moderators

Código ilegível, indente o código adequadamente.

Não se usa source como parâmetro de função.

Você precisa verificar se source é o jogador ou o veículo que colidiu no marker. Ambos podem estar ativando as funções em duplicada.

Nas linhas 30 e 31 vc está atribuindo duas funções para serem ativadas no mesmo marker, no entanto em uma delas na linha 42 você está destruindo o marker, o que pode impedir a outra função de funcionar por causa da linha 49.

Link to comment

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...