C0DE Posted January 3, 2019 Share Posted January 3, 2019 (edited) Bom eu tava criando um script de quando o carro chega a uma certa vida ele não pega fogo e nem explode mais com isso eu escolhi uma vida baixa mais cada batida como vocês sabe pode dar dano ate demais e ate pegar fogo então queria saber pelo menos o nome do código que preciso fazer para setar a vida do carro Edited January 3, 2019 by C0DE Link to comment
Other Languages Moderators androksi Posted January 3, 2019 Other Languages Moderators Share Posted January 3, 2019 setElementHealth Link to comment
C0DE Posted January 3, 2019 Author Share Posted January 3, 2019 Eu tentei usar setElementHealth so que não funcionou script abaixo function vehicleHPVerify (loss) local thePlayer = getVehicleController (source) if (getElementHealth (source) < 300) then setVehicleDamageProof (source, true) setVehicleEngineState (source, false) setElementHealth( vehicle, 300 ) if (thePlayer) then outputChatBox ("Seu veículo quebrou o motor. Chame um mecânico.", thePlayer) end end end addEventHandler ("onVehicleDamage", root, vehicleHPVerify) function vehicleEngineDisable (thePlayer, seat, jacked) if (getElementHealth (source) < 300) then if (seat == 0) then setVehicleDamageProof (source, true) setVehicleEngineState (source, false) setElementHealth( vehicle, 300 ) end else setVehicleDamageProof (source, false) end end addEventHandler ("onVehicleEnter", root, vehicleEngineDisable) function antiVehicleEngine (cmd) if (cmd == "motor") then local theVehicle = getPlayerOccupiedVehicle (source) if (theVehicle) then if (getPedOccupiedVehicleSeat (source) == 0) then if (getElementHealth (theVehicle) < 300) then cancelEvent() outputChatBox ("O motor falhou.", source) setVehicleEngineState (theVehicle, false) setElementHealth( vehicle, 300 ) end end end end end addEventHandler ("onPlayerCommand", root, antiVehicleEngine) Link to comment
DNL291 Posted January 3, 2019 Share Posted January 3, 2019 Tenta: "onClientVehicleDamage" getElementHealth cancelEvent setElementHealth Link to comment
Other Languages Moderators androksi Posted January 4, 2019 Other Languages Moderators Share Posted January 4, 2019 Na função setElementHealth, troque vehicle por source. Link to comment
Other Languages Moderators Lord Henry Posted January 4, 2019 Other Languages Moderators Share Posted January 4, 2019 17 hours ago, C0DE said: Eu tentei usar setElementHealth so que não funcionou script abaixo function vehicleHPVerify (loss) local thePlayer = getVehicleController (source) if (getElementHealth (source) < 300) then setVehicleDamageProof (source, true) setVehicleEngineState (source, false) setElementHealth( vehicle, 300 ) if (thePlayer) then outputChatBox ("Seu veículo quebrou o motor. Chame um mecânico.", thePlayer) end end end addEventHandler ("onVehicleDamage", root, vehicleHPVerify) function vehicleEngineDisable (thePlayer, seat, jacked) if (getElementHealth (source) < 300) then if (seat == 0) then setVehicleDamageProof (source, true) setVehicleEngineState (source, false) setElementHealth( vehicle, 300 ) end else setVehicleDamageProof (source, false) end end addEventHandler ("onVehicleEnter", root, vehicleEngineDisable) function antiVehicleEngine (cmd) if (cmd == "motor") then local theVehicle = getPlayerOccupiedVehicle (source) if (theVehicle) then if (getPedOccupiedVehicleSeat (source) == 0) then if (getElementHealth (theVehicle) < 300) then cancelEvent() outputChatBox ("O motor falhou.", source) setVehicleEngineState (theVehicle, false) setElementHealth( vehicle, 300 ) end end end end end addEventHandler ("onPlayerCommand", root, antiVehicleEngine) Já vi o nome dessa function em algum lugar. Copiou de outro tópico... Link to comment
Gaimo Posted January 21, 2019 Share Posted January 21, 2019 On 04/01/2019 at 12:46, Lord Henry said: Já vi o nome dessa function em algum lugar. Copiou de outro tópico... https://forum.multitheftauto.com/topic/113709-ajuda-hp-de-veiculos/?tab=comments#comment-939886 Link to comment
C0DE Posted January 24, 2019 Author Share Posted January 24, 2019 On 04/01/2019 at 12:46, Lord Henry said: Já vi o nome dessa function em algum lugar. Copiou de outro tópico... Não copiei de nenhum tópico 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