-- LUA Script - precede every function and global member with lowercase name of script local time1 = 1; local time2 = g_Time; local timepassed = time2 - time1; local imagenumber = 0; local healtnumber = 0; local max_images = 21; local max_healt = 100; local delay = 2; local toggle = 0; local pressed = 0; local hud_on = 0; local me_hud_on = 1; local ready = 0; local test = 1; function hud_init(e) LoadImages("hud") HideHuds(); end function hud_main(e) if g_PlayerHealth and ready == 0 then ShowMeHuds(e); ready = 1; end --TextCenterOnX(70,70,4,GetScancode()) PromptDuration("Press 'F5' for toggle hud.",1500) --KEY AKTION if GetScancode() == 63 and pressed == 0 then if hud_on == 1 then HideHuds(); hud_on = 0; me_hud_on = 1; pressed = 1; toggle = 1; ShowMeHuds(); else ShowHuds(); hud_on = 1; me_hud_on = 0; pressed = 1; toggle = 1; HideMeHuds(); end elseif GetScancode() == 0 then pressed = 0 end -- SHOW INFO TEXT if toggle == 1 then if time1 == 0 then time1 = g_Time end time2 = g_Time timepassed = (time2 - time1) / 1000 if hud_on == 0 then if timepassed <= delay then TextCenterOnXColor(50,50,4,"Modern Hud aktiv, press 'F5' for toggle.",255,100,100) elseif timepassed >= delay then time1 = 0 toggle = 0 end elseif hud_on == 1then if timepassed <= delay then TextCenterOnXColor(50,50,4,"Old Hud aktiv, press 'F5' for toggle.",255,100,100) elseif timepassed >= delay then time1 = 0 toggle = 0 end end end --Update the MeHuds if me_hud_on == 1 then ShowMeHuds(e); HideHuds(); else HideMeHuds(e); ShowHuds(); end end function gif(e) if timepassed >= delay then ShowImage(imagenumber) time1 = 0 if imagenumber < max_images - 1 then imagenumber = imagenumber + 1 else imagenumber = 0 end end end function ShowMeHuds(e) --for hp=5, max_healt do --for i=1, max_images-1 do --if g_PlayerHealth <= healtnumber then --end --end --end if g_PlayerHealth <= 0 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(000) elseif g_PlayerHealth <= 5 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(001) elseif g_PlayerHealth <= 10 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(002) elseif g_PlayerHealth <= 15 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(003) elseif g_PlayerHealth <= 20 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(004) elseif g_PlayerHealth <= 25 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(005) elseif g_PlayerHealth <= 30 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(006) elseif g_PlayerHealth <= 35 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(007) elseif g_PlayerHealth <= 40 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(008) elseif g_PlayerHealth <= 45 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(009) elseif g_PlayerHealth <= 50 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(010) elseif g_PlayerHealth <= 55 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(011) elseif g_PlayerHealth <= 60 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(012) elseif g_PlayerHealth <= 65 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(013) elseif g_PlayerHealth <= 70 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(014) elseif g_PlayerHealth <= 75 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(015) elseif g_PlayerHealth <= 80 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(016) elseif g_PlayerHealth <= 85 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(017) elseif g_PlayerHealth <= 90 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(018) elseif g_PlayerHealth <= 95 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(019) elseif g_PlayerHealth >= 100 then SetImagePosition(-0.5,-0.5) SetImageAlignment(1) ShowImage(020) end end function HideMeHuds(e) for i=1, max_images-1 do HideImage(imagenumber) HideImage(i) end end