Jump to content

help plz


FiGo

Recommended Posts

I changed it and it doesn't work

 

function fix()
   CarHP = getElementHealth(source)
    if ( getElementModel(source) == 451 ) then
    if ( CarHP < 90 ) then
        setElementHealth ( source, 100 )
    end
end
end
addEventHandler("onClientVehicleDamage", root, fix)

 

help plz

 

Link to comment
  • Moderators

The maximum health of the vehicle is 1000, not 100, so:

 

-- CLIENT SIDE

function fix()
    local CarHP = getElementHealth(source) -- use as local variable, because you want to use this variable inside this function only
    
    if (getElementModel(source) == 451) then
        if (CarHP < 900) then
            setElementHealth(source, 1000)
        end
    end
end
addEventHandler("onClientVehicleDamage", root, fix)

 

  • Thanks 1
Link to comment
  • Moderators
18 minutes ago, FiGo said:

i added it but it donot work I need to make when the car got damaged it increases by +5 I mean if it is 90 it be 95 and like that until it becomes 100

 

increase old health with 50

setElementHealth(source, CarHP + 50)

 

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...