Jump to content

Is this right?


Lloyd Logan

Recommended Posts

Perfect! How would i get the health of a vehicle!

Thanks

getElementHealth: This function returns the current health for the specified element. This can be a player, a ped, or a vehicle.

I done this but it always says Your car is fine? even if my car is on fire.

function healthin( thePlayer ) 
    local vehiclee = getPedOccupiedVehicle( thePlayer ) 
    if vehiclee then 
    local health = getElementHealth( vehiclee ) 
    if (health<=50) then 
    outputChatBox("Time For a repair!", thePlayer) 
    else 
    outputChatBox("Your car is fine!", thePlayer) 
    end 
else 
    outputChatBox("You're not in a vehicle!", thePlayer) 
    end 
end 
addCommandHandler("carh", healthin) 

Link to comment
function healthin( thePlayer ) 
    local vehiclee = getPedOccupiedVehicle( thePlayer ) 
    if vehiclee then 
    local health = getElementHealth( vehiclee ) 
    if (health<=500) then 
    outputChatBox("Time For a repair!", thePlayer) 
    else 
    outputChatBox("Your car is fine!", thePlayer) 
    end 
else 
    outputChatBox("You're not in a vehicle!", thePlayer) 
    end 
end 
addCommandHandler("carh", healthin) 

Link to comment
Max vehicle health is 1000%.

Is there anyway to change the health value to 100 instead of 1000, so it would be /setcarhp 100?

With math you can do it: 10*100 will do the job.

So, calculate in my script, that if a player enters /setcarhp 100, just multiply the 100 by 10?, and if so, how would I do this?

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