Bullyn Posted April 16, 2019 Share Posted April 16, 2019 (edited) 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 April 16, 2019 by DNL291 Use o botão para o código Lua da próxima vez Link to comment
Jonas^ Posted April 16, 2019 Share Posted April 16, 2019 (edited) 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 April 16, 2019 by Jonas^ Correção. 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