Jump to content

image delete problems


makkocska

Recommended Posts

Hi guys!

I'am a begginer lua scripter,so please "look away from my mistakes" ...

So there is a function -- > delete images, but i cant fix it because its only run once..when i start it.

How can i do that: check every seconds and if player health more than 80 - > do the destroy..

function imagedown() 
local HP = getElementHealth ( getLocalPlayer() ) 
    if(HP >= 80) then 
    destroyElement(pic1) 
    destroyElement(pic2) 
    destroyElement(pic3) 
    destroyElement(pic4) 
    destroyElement(pic5) 
    end 
end 
addEventHandler('onClientResourceStart', resourceRoot, imagedown) 

Thank you!

Link to comment

If you want to use dxDrawImage you need to put the function on event onClientRender. The image will be drawn for only 1 frame. With this render it will be kept drawing it on each frame. The only thing you have to do then is:

local HP = getElementHealth(getLocalPlayer()) 
    if (HP < 80) then 
        dxDrawImage(...) 
    end 

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