ODutii Posted August 3, 2019 Posted August 3, 2019 Não sei o que está dando errado, no console diz que carrovida <= 256 não se compara com o numero. function desligarcar() local theVehicle = getPedOccupiedVehicle(source) local carrovida = getElementHealth(theVehicle) if carrovida < 256 then setVehicleEngineState ( theVehicle, false ) outputChatBox("#BDBDBDVeículo quebrado, chame um mecânico.",source,0,255,0,true) setVehicleEngineState ( theVehicle, true ) end end addEventHandler("onVehicleDamage", root, desligarcar)
Eficiencia Posted August 3, 2019 Posted August 3, 2019 function desligarcar() local theVehicle = getPedOccupiedVehicle(source) local carrovida = getElementHealth(theVehicle) if carrovida <= 256 then setVehicleEngineState ( theVehicle, false ) outputChatBox("#BDBDBDVeículo quebrado, chame um mecânico.",source,0,255,0,true) setVehicleEngineState ( theVehicle, true ) end end addEventHandler("onVehicleDamage", root, desligarcar)
Other Languages Moderators Lord Henry Posted August 3, 2019 Other Languages Moderators Posted August 3, 2019 (edited) Isso acontece pois source não é um jogador no evento onVehicleDamage e sim o veículo que recebeu o dano. Isso significa que getPedOccupiedVehicle está retornando false. E getElementHealth (false) nunca vai retornar algo também. Ele está reclamando que não tem como fazer a comparação if false < 256 then. function desligarcar () local carrovida = getElementHealth (source) local thePlayer = getVehicleController (source) if (carrovida < 256) then setVehicleEngineState (source, false) if (isElement (thePlayer)) then outputChatBox ("Seu veículo quebrou, chame um mecânico.", thePlayer, 189, 189, 189) end end end addEventHandler ("onVehicleDamage", root, desligarcar) Edited August 3, 2019 by Lord Henry
DNL291 Posted August 3, 2019 Posted August 3, 2019 Você já havia postado o mesmo tópico aqui: @ODutii Não precisa criar outro tópico, só postar no primeiro.
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