C0DE Posted January 3, 2019 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
androksi Posted January 3, 2019 Posted January 3, 2019 setElementHealth Hello, world. Tutorial sobre interação de BOTs do Discord com o seu servidor - Visitar (Brazilian Portuguese) Tutorial sobre tabelas - Visitar (Brazilian Portuguese) Tutorial sobre banco de dados - Visitar (Brazilian Portuguese)
C0DE Posted January 3, 2019 Author 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)
DNL291 Posted January 3, 2019 Posted January 3, 2019 Tenta: "onClientVehicleDamage" getElementHealth cancelEvent setElementHealth Please do not PM me with scripting related question nor support, use the forums instead.
androksi Posted January 4, 2019 Posted January 4, 2019 Na função setElementHealth, troque vehicle por source. Hello, world. Tutorial sobre interação de BOTs do Discord com o seu servidor - Visitar (Brazilian Portuguese) Tutorial sobre tabelas - Visitar (Brazilian Portuguese) Tutorial sobre banco de dados - Visitar (Brazilian Portuguese)
Moderators Lord Henry Posted January 4, 2019 Moderators 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... Eu te ajudei ou achou meu comentário útil? Não esqueça de deixar um Thanks! Minhas contribuições para a comunidade: LordHenry - MTA Wiki Profile Inscreva-se no meu canal do YouTube: Lord Henry - Entertainment Discord Oficial do MTA: https://mtasa.com/discord Blacklist e Whitelist de Scripters: Planilha Por favor, não me envie mensagens privadas solicitando suporte. Crie um tópico no fórum em vez disso.
Gaimo Posted January 21, 2019 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
C0DE Posted January 24, 2019 Author 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
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