Jump to content

Galera tó tentando criar marker com attach no veiculo ajudem ai pf


Recommended Posts

Marker_Van = {}

function Pegar_Caixa_trabLixeiro (source)
	local Occupied_Veh = getPedOccupiedVehicle(source)
	local Veiculo = getPedOccupiedVehicle(source)
	    if not isPedInVehicle ( source ) then    
            if (getElementModel (Occupied_Veh) == 408) then 		
				Marker_Van[source] = createMarker ( 0, 0, 0, "cylinder", 1.2, 16, 111, 231, 90)
				attachElements (  Marker_Van[source], Veiculo, 0, -4.5, -1.2 )
				setElementVisibleTo ( Marker_Van[source], source, true ) 
			end
		end
	end
end

 

Link to post
9 hours ago, FbzinnN said:



Marker_Van = {}

function Pegar_Caixa_trabLixeiro (source)
	local Occupied_Veh = getPedOccupiedVehicle(source)
	local Veiculo = getPedOccupiedVehicle(source)
	    if not isPedInVehicle ( source ) then    
            if (getElementModel (Occupied_Veh) == 408) then 		
				Marker_Van[source] = createMarker ( 0, 0, 0, "cylinder", 1.2, 16, 111, 231, 90)
				attachElements (  Marker_Van[source], Veiculo, 0, -4.5, -1.2 )
				setElementVisibleTo ( Marker_Van[source], source, true ) 
			end
		end
	end
end

 

Seu script tem vários erros.

1° porque você está usando 2x o getPedOccupiedVehicle(source)?

2° todo o seu código só vai rodar se o source não estiver em um veículo ( if not isPedInVehicle ( source ) then ), não faz sentido já que o veículo que o marker vai ser anexado é o veículo em que o source está. 

Marker_Van = {}

function Pegar_Caixa_trabLixeiro (source)
     local Veiculo = getPedOccupiedVehicle(source)   
     if isElement(Veiculo) and getElementModel (Veiculo) == 408 then 		
          Marker_Van[source] = createMarker ( 0, 0, 0, "cylinder", 1.2, 16, 111, 231, 90)
          attachElements (  Marker_Van[source], Veiculo, 0, -4.5, -1.2 )
          setElementVisibleTo ( Marker_Van[source], source, true ) 
     end
end

Obs: desse jeito só vai criar o marker se o source estiver dentro do carro. 

Edited by Boechat
Link to post

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