Jump to content

Help! Scipt damage vehicle


Lally

Recommended Posts

Hello community!
I myself need a little help. I like when the car has 300 hp appear as an icon on the screen as the kicker motor. But I can not find the wiki community.
Here is what I tried to do:

Quote

function createSpeedo()
    cars = getElementsByType("vehicle",root,true)
    for num, car in ipairs(cars) do
       local dividedCarHealth = getElementHealth(car) / 10
        local motor = math.floor(getElementHealth(car))
        if motor > 500 then
            dxDrawImage( screenWidth - 200, 32,32,37,"images/hud/damage.png")
            ax = ax - 34
        end
    end
end

 

Link to comment

drawimage in a loop drawing in the same position and in a function that i guess is not called every frame... i don't get it.
Also i did not understand what do you want to achieve... what is a kicker motor? and what do you mean with you can't find "wiki community"???? do you mean wiki?

Explain more...

PS: you are "trying" to draw an image called damage when the vehicle is in "good" health (1/3+, if i remember correctly the cars catch fire at 250hp): is this what really want to do?

Link to comment
On 1/22/2017 at 14:36, Lally said:

Hello community!
I myself need a little help. I like when the car has 300 hp appear as an icon on the screen as the kicker motor. But I can not find the wiki community.
Here is what I tried to do:

function createSpeedo()
    
    for num, car in ipairs(cars) do
       local dividedCarHealth = getElementHealth(car) / 10
        local motor = math.floor(getElementHealth(car))
        if motor > 500 then
            dxDrawImage( screenWidth - 200, 32,32,37,"images/hud/damage.png")
            ax = ax - 34
        end
    end
end

 

function desBveh(veh)
    local attached = getAttachedElements ( veh )
    if ( attached ) then
        for k,element in ipairs(attached) do
            if getElementType ( element ) == "blip" then
                destroyElement ( element )
            end
        end
    end
end 

setTimer(
function()
cars = getElementsByType("vehicle",root,true)
    for k, car in ipairs(cars) do
        local motor = math.floor(getElementHealth(car))
        if motor < 500 then
                desBveh(car)
             createBlipAttachedTo(car,20)
            else
                desBveh(car)
        end
    end
end, 300000, 0)

 

 

 

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