FbzinnN Posted March 29, 2021 Share Posted March 29, 2021 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 comment
Moderators Citizen Posted March 29, 2021 Moderators Share Posted March 29, 2021 Moved to Portuguese scripting section. 1 Link to comment
Boechat Posted March 30, 2021 Share Posted March 30, 2021 (edited) 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 March 30, 2021 by Boechat 1 Link to comment
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now