ODutii Posted July 30, 2019 Posted July 30, 2019 (edited) Estou tentando fazer que quando o veiculo chega a um certo nivel de dano o veiculo desliga, podem me ajudar? >> nao funcionou function stopengine(player,seat) local vehp = getPedOccupiedVehicle(source) local health = getElementHealth(vehp) if health <= 300 then setVehicleEngineState(vehp, false) end end addEventHandler("onVehicleDamage",root,stopengine) Edited July 31, 2019 by Lord Henry Código convertido de texto para Lua.
DNL291 Posted July 30, 2019 Posted July 30, 2019 getPedOccupiedVehicle você está usando source nessa função, e source já é o veículo. Só trocar vehp por source.
ODutii Posted August 4, 2019 Author Posted August 4, 2019 Não está funcionando [10:38:28] WARNING: [G]S_PainelVeiculo\server.Lua:138: Bad argument @ 'getPedOccupiedVehicle' [Expected ped at argument 1, got vehicle] [10:38:28] WARNING: [G]S_PainelVeiculo\server.Lua:139: Bad argument @ 'getElementHealth' [Expected element at argument 1, got boolean] [10:38:28] ERROR: [G]S_PainelVeiculo\server.Lua:140: attempt to compare boolean with number Esse é o console
DNL291 Posted August 4, 2019 Posted August 4, 2019 Já foi explicado o porquê nos seus dois tópicos. source já vai retornar o veículo danificado não precisa de getPedOccupiedVehicle. Veja esta resposta no outro tópico: https://forum.multitheftauto.com/topic/119164-vehicle-is-broken/?do=findComment&comment=961474 E continue lá.
Recommended Posts