Jump to content

Alguem me Ajuda a Resolver Isso !


Recommended Posts

Tou aprendendo agora, mas eu queria saber como eu posso destruir o carro depois que o player desce dele ??

Alguem me ajuda porfavor 

local vehMark = createMarker(-2138.5202636719, -403.91302490234, 34.343013763428, "cylinder", 4.5, 255,255,255, 20)

function vehicleSpawner(hitElement,matchingDimension)
    if getElementType(hitElement) == "player" then
        if getPedOccupiedVehicle(hitElement) == false then
        local x,y,z = getElementPosition(hitElement)
            local veh = createVehicle(551, x,y,z)
            warpPedIntoVehicle(hitElement,veh)
            
        end
    end 
end 
addEventHandler("onMarkerHit",vehMark,vehicleSpawner)

 

Edited by DNL291
Use o botão para o código Lua da próxima vez
Link to comment

Tente assim:

 

local vehMark = createMarker (-2138.5202636719, -403.91302490234, 34.343013763428, "cylinder", 4.5, 255,255,255, 20)
local veh = {}

function vehicleSpawner (thePlayer)
	if getElementType(thePlayer) == "player" then
		if getPedOccupiedVehicle (thePlayer) == false then
			local x, y, z = getElementPosition (thePlayer)
			veh[thePlayer] = createVehicle (551,  x, y, z)
			warpPedIntoVehicle (thePlayer, veh[thePlayer])
		else
			outputChatBox ("@Você já está em um veículo.", thePlayer)
		end	
	end
end
addEventHandler ("onMarkerHit", vehMark, vehicleSpawner)

function destroyVehicleTable (thePlayer)
	if (veh[thePlayer]) and isElement (veh[thePlayer]) then
		destroyElement (veh[thePlayer])
		veh[thePlayer] = nil
	end
	outputChatBox ("@Destruí o carro.", thePlayer)
end
addEventHandler ("onVehicleExit", getRootElement(), destroyVehicleTable)

 

Edited by Jonas^
Correção.
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...