FoxG^ Posted March 30, 2019 Posted March 30, 2019 (edited) Falae rapaziada blz? então mano eu estou com um probleminha em um marker, tem o marker1 e o marker2 nas linhas, o marker2 que estou tendo um pouco de problema queria deixar pra qualquer um que pegasse o veiculo no marker1 pudesse excluir até pq somente quem pega o veiculo no marker1 que pode excluir queria deixar pra todos se alguem puder ajudar tmj! local marker1 = createMarker ( 2185.5439453125,-1811.8256835938,13.546875 -1, "cylinder", 1.2, 0 , 255, 0, 155 ) local marker2 = createMarker ( 2157.5869140625,-1808.6865234375,13.387050628662 -1, "cylinder", 3, 255 , 0, 0, 155) veh = {} function vehicle ( marker, md ) if md then if marker == marker1 then if not isPedInVehicle ( source ) then if isElement ( veh[source] ) then destroyElement(veh[source]) end local x,y,z = getElementPosition(source) veh[source] = createVehicle ( 490, 2185.0043945313,-1805.0360107422,13.370622634888, -0, 0, 5.1420917510986 ) warpPedIntoVehicle ( source, veh[source] ) end elseif marker == marker2 then if veh[source] and isElement ( veh[source] ) then destroyElement(veh[source]) end end end end addEventHandler ( "onPlayerMarkerHit", getRootElement ( ), vehicle ) Edited March 30, 2019 by joaolamar
Jonas^ Posted March 30, 2019 Posted March 30, 2019 Ué, mas ele já não ta fazendo isso? quando se pega o veículo ele ta colocando ele na tabela, dai quando se passa no marker 2 ele destroy.
Other Languages Moderators Lord Henry Posted March 30, 2019 Other Languages Moderators Posted March 30, 2019 Eu n entendi nada que ele disse '-' 1
#DeltaSCR Posted March 30, 2019 Posted March 30, 2019 Tente assim, talvez resolva: local marker1 = createMarker ( 2185.5439453125,-1811.8256835938,13.546875 -1, "cylinder", 1.2, 0 , 255, 0, 155 ) local marker2 = createMarker ( 2157.5869140625,-1808.6865234375,13.387050628662 -1, "cylinder", 3, 255 , 0, 0, 155) veh = {} function vehicle (marker, md) if md then if marker == marker1 then if not isPedInVehicle (source) then if isElement (veh[source]) then destroyElement(veh[source]) veh[source] = nil end local x,y,z = getElementPosition(source) veh[source] = createVehicle (490, 2185.0043945313,-1805.0360107422,13.370622634888, -0, 0, 5.1420917510986) warpPedIntoVehicle (source, veh[source]) end elseif marker == marker2 then if veh[source] and isElement (veh[source]) then destroyElement(veh[source]) veh[source] = nil end end end end addEventHandler ("onPlayerMarkerHit", getRootElement (), vehicle) 1
FoxG^ Posted April 1, 2019 Author Posted April 1, 2019 On 30/03/2019 at 19:22, #DeltaSCR said: Tente assim, talvez resolva: local marker1 = createMarker ( 2185.5439453125,-1811.8256835938,13.546875 -1, "cylinder", 1.2, 0 , 255, 0, 155 ) local marker2 = createMarker ( 2157.5869140625,-1808.6865234375,13.387050628662 -1, "cylinder", 3, 255 , 0, 0, 155) veh = {} function vehicle (marker, md) if md then if marker == marker1 then if not isPedInVehicle (source) then if isElement (veh[source]) then destroyElement(veh[source]) veh[source] = nil end local x,y,z = getElementPosition(source) veh[source] = createVehicle (490, 2185.0043945313,-1805.0360107422,13.370622634888, -0, 0, 5.1420917510986) warpPedIntoVehicle (source, veh[source]) end elseif marker == marker2 then if veh[source] and isElement (veh[source]) then destroyElement(veh[source]) veh[source] = nil end end end end addEventHandler ("onPlayerMarkerHit", getRootElement (), vehicle) Não funcionou, Pra quem não entendeu é o seguinte são dois markers o 1 para criar o veiculo e o 2 para destruir o veiculo, O marker2 tem 1 problema que só quem criou o veiculo consegue destruir ele no marker2 queria que tipo o marker2 pudesse quaquer pessoa passar no marker que iria destruir o veiculo !
#DeltaSCR Posted April 1, 2019 Posted April 1, 2019 Ah sim, realmente não vai funcionar você está indicando para destruir somente o elemento veh, para isso, você deverá verificar se o Player está em um veículo, e depois criar uma variável obtendo o Veículo
Other Languages Moderators Lord Henry Posted April 2, 2019 Other Languages Moderators Posted April 2, 2019 (edited) local marker1 = createMarker ( 2185.5439453125,-1811.8256835938,13.546875 -1, "cylinder", 1.2, 0 , 255, 0, 155 ) local marker2 = createMarker ( 2157.5869140625,-1808.6865234375,13.387050628662 -1, "cylinder", 3, 255 , 0, 0, 155) veh = {} function criaVeh () if veh[source] and isElement (veh[source]) then destroyElement (veh[source]) veh[source] = nil end local x, y, z = getElementPosition(source) veh[source] = createVehicle (490, x, y, z + 1, -0, 0, 5.1420917510986) warpPedIntoVehicle (source, veh[source]) end addEventHandler ("onPlayerMarkerHit", marker1, criaVeh) function detonaVeh (marker, matchingDimension) local theVeh = getPedOccupiedVehicle (source) if theVeh and isElement(theVeh) then destroyElement(theVeh) theVeh = nil end end addEventHandler ("onPlayerMarkerHit", marker2, detonaVeh) Edited April 2, 2019 by Lord Henry
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