Jubs_noob Posted November 8, 2021 Share Posted November 8, 2021 function vehiclefailures() failede = true local vehicle = getPedOccupiedVehicle(localPlayer) if ( vehicle and (getVehicleType(vehicle) == "Automobile")) then if getElementHealth(vehicle) < 550 then triggerServerEvent("Caroff", getRootElement(), vehicle) setTimer ( function() triggerServerEvent("Caron", getRootElement(), vehicle) end, 3000, 1 ) end end end addEventHandler("onClientVehicleDamage", root, vehiclefailures) addEventHandler("onClientVehicleEnter", root, vehiclefailures) function enginefailures() local vehicle = getPedOccupiedVehicle(localPlayer) if ( vehicle and (getVehicleType(vehicle) == "Automobile")) then if getElementHealth(vehicle) < 550 then if not failede then return end setTimer( function() if not failede then return end triggerServerEvent("failurex", getRootElement(), vehicle) triggerServerEvent("Caroff", getRootElement(), vehicle) local sound = playSound("failure.wav") setTimer ( function() triggerServerEvent("Caron", getRootElement(), vehicle) end, 3000, 1 ) failede = false setTimer( function() failede = true end, 25000, 1 ) end, 10, 1 ) end end end addEventHandler ( "onClientPreRender", root, enginefailures ) function enginesoundf() if not sounding then sound=playSound("failure.wav") setSoundVolume(sound, 0.5) setTimer ( function() sounding = true end, 5000, 1 ) end end addEvent ( "failureclient", true ) addEventHandler ( "failureclient", getRootElement ( ), enginesoundf ) Gostaria de ajuda pra colocar quando o veiculo chegar em 350% de vida ela não ligar mas não consigo ja tentei Link to comment
Vampire Posted November 8, 2021 Share Posted November 8, 2021 Hello. I advise you to post your script issue in the correct section using your native language (Portuguese): https://forum.multitheftauto.com/forum/127-programação-em-lua/ However, you can also get help in the English section: https://forum.multitheftauto.com/forum/71-scripting/ Link to comment
Moderators Vinyard Posted November 9, 2021 Moderators Share Posted November 9, 2021 Hi, welcome to the forums! @Jubs_noob As stated above, please refrain from posting non-English topics outside the Portuguese section. I've moved your thread to the Portuguese section this time so you can get better answers in your native language. Link to comment
KiritoAguiar Posted November 11, 2021 Share Posted November 11, 2021 (edited) Usa onVehicleEnter junto com getElementHealth setVehicleEngineState E pra evitar de ligarem o carro dnv com algum outro mod vc pode usar um setTimer infinito pra verificar de tempo em tempo Edited November 11, 2021 by KiritoAguiar 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