makkocska Posted November 3, 2014 Share Posted November 3, 2014 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
ALw7sH Posted November 3, 2014 Share Posted November 3, 2014 use onClientRender or onClientPreRender Link to comment
makkocska Posted November 3, 2014 Author Share Posted November 3, 2014 okay its work, thank you but actually, now if the player health is >=80 debugscript 3 spam me : bad element pointer @ 'destroyElement' how can i fix it ? I mean .. if >=80 and once restarted dont restart again only if lower than 80 . ! Link to comment
ALw7sH Posted November 3, 2014 Share Posted November 3, 2014 if pic1 then destroyElement(pic1) end Link to comment
Castillo Posted November 3, 2014 Share Posted November 3, 2014 You should consider using dxDrawImage instead of GUI, since it should be more efficient. Link to comment
makkocska Posted November 3, 2014 Author Share Posted November 3, 2014 doesnt work with dxDrawImage Link to comment
Et-win Posted November 5, 2014 Share Posted November 5, 2014 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
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now