Jump to content

MARKER PARA VEICULO


Recommended Posts

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 by joaolamar
Link to comment

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)

 

  • Thanks 1
Link to comment
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 !

Link to comment
  • Other Languages Moderators
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 by Lord Henry
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...