boro Posted August 21, 2014 Share Posted August 21, 2014 Hi , i make script for show health images but this script still show only image number 8 why ? what is bad? please help ty.. function healthimages() sWidth, sHeight = guiGetScreenSize() local heal = getElementHealth(getLocalPlayer()) if heal == 88 or 89 or 90 or 91 or 92 or 93 or 94 or 95 or 96 or 97 or 98 or 99 or 100 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/0.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal == 75 or 76 or 77 or 78 or 79 or 80 or 81 or 82 or 83 or 84 or 85 or 86 or 87 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/1.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal == 62 or 63 or 64 or 65 or 66 or 67 or 68 or 69 or 70 or 71 or 72 or 73 or 74 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/2.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal == 49 or 50 or 51 or 52 or 53 or 54 or 55 or 56 or 57 or 58 or 59 or 60 or 61 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/3.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal == 36 or 37 or 38 or 39 or 40 or 41 or 42 or 43 or 44 or 45 or 46 or 47 or 48 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/4.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal == 23 or 24 or 25 or 46 or 27 or 28 or 29 or 30 or 31 or 32 or 33 or 34 or 35 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/5.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal == 10 or 11 or 12 or 13 or 14 or 15 or 16 or 17 or 18 or 19 or 20 or 21 or 22 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/6.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal == 6 or 7 or 8 or 9 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/7.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal == 1 or 2 or 3 or 4 or 5 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/8.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end end addEventHandler("onClientRender", getRootElement(), healthimages) Link to comment
undefined Posted August 21, 2014 Share Posted August 21, 2014 if heal == 88 or heal == 89 or heal == 90 or heal == 91 or heal == 92 or heal == 93 or heal == 94 or heal == 95 or heal == 96 or heal == 97 or heal == 98 or heal == 99 or heal == 100 then Replace this code and try this. OR: if heal >= 88 and 100 <= heal then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/0.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end Link to comment
Moderators IIYAMA Posted August 21, 2014 Moderators Share Posted August 21, 2014 Player health can also be: 88.5 Second example is bug proof and faster. Link to comment
boro Posted August 21, 2014 Author Share Posted August 21, 2014 Hm i try it but this still show only image 8 in all % function healthimages() sWidth, sHeight = guiGetScreenSize() local heal = getElementHealth(getLocalPlayer()) if heal >= 88 and 100 <= heal then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/0.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal >= 87 and 75 <= heal then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/1.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal >= 74 and 62 <= heal then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/2.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal >= 61 and 49 <= heal then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/3.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal >= 48 and 36 <= heal then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/4.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal >= 35 and 23 <= heal then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/5.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal >= 22 and 10 <= heal then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/6.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal >= 9 and 6 <= heal then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/7.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end if heal >= 5 and 1 <= heal then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/8.png",0.0,0.0,0.0,tocolor(255,255,255,255),false) end end addEventHandler("onClientRender", getRootElement(), healthimages) Link to comment
Moderators IIYAMA Posted August 21, 2014 Moderators Share Posted August 21, 2014 local sWidth, sHeight = guiGetScreenSize() local colorWhite = tocolor(255,255,255,255) local healthimages = function () local heal = getElementHealth(localPlayer) if heal >= 88 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/0.png",0.0,0.0,0.0,colorWhite,false) elseif heal >= 75 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/1.png",0.0,0.0,0.0,colorWhite,false) elseif heal >= 62 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/2.png",0.0,0.0,0.0,colorWhite,false) elseif heal >= 49 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/3.png",0.0,0.0,0.0,colorWhite,false) elseif heal >= 36 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/4.png",0.0,0.0,0.0,colorWhite,false) elseif heal >= 23 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/5.png",0.0,0.0,0.0,colorWhite,false) elseif heal >= 10 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/6.png",0.0,0.0,0.0,colorWhite,false) elseif heal >= 6 then dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/7.png",0.0,0.0,0.0,colorWhite,false) else dxDrawImage( (600.0/800)*sWidth, (175.0/600)*sHeight, (104.0/800)*sWidth, (54.0/600)*sHeight,"hud/images/8.png",0.0,0.0,0.0,colorWhite,false) end end addEventHandler("onClientRender",root, healthimages) Link to comment
boro Posted August 21, 2014 Author Share Posted August 21, 2014 YES it work ty IIYAMA 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