Jump to content

How to disable vehicle damage from fists?


Neproify

Recommended Posts

Hello, I want to disable vehicle damage from player fists. I do this like that:

addEventHandler("onClientVehicleDamage", root, function(attacker, weapon, loss, x, y, z, tyre) 
    if weapon == 0 then 
        cancelEvent() 
        source:setDamageProof(true) 
        setTimer(function(source) 
            source:setDamageProof(false) 
        end, 200, 1, source) 
    end 
end) 

But it don't work. The health of vehicle is okay, but panels and doors are damaged. Can anyone help me?

Link to comment

it's possible. Use these function. First get the health of the vehicle, after that fix the vehicle (everythink will be repaired, also the health of the vehicle) and after that set the old health of the vehicle. But maybe therer's also a function for that but i dont know about it.

  
getElementHealth 
fixVehicle 
setElementHealth 
  

  • Thanks 1
Link to comment
it's possible. Use these function. First get the health of the vehicle, after that fix the vehicle (everythink will be repaired, also the health of the vehicle) and after that set the old health of the vehicle. But maybe therer's also a function for that but i dont know about it.
  
getElementHealth 
fixVehicle 
setElementHealth 
  

You are right's.

setElementHealth = only set Health car

fixVehicle = repaired all

Link to comment
it's possible. Use these function. First get the health of the vehicle, after that fix the vehicle (everythink will be repaired, also the health of the vehicle) and after that set the old health of the vehicle. But maybe therer's also a function for that but i dont know about it.
  
getElementHealth 
fixVehicle 
setElementHealth 
  

You are right's.

setElementHealth = only set Health car

fixVehicle = repaired all

Please note that if you hit a pole with a vehicle and someone hits the vehicle with a first afterwards, you're going to repair the entire vehicle. You can also just get the health from the vehicle, get all the panelstates before the player hits the vehicle ( in the same function ) and then reset them back to what they were and set the health back. This might be really tricky but can be done.

Link to comment

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...