scolen Posted June 8, 2023 Posted June 8, 2023 (edited) I have a small problem.. I made a progress bar so that it is centered on my display but it doesn't fit on the display of other players. How to make one? @Shady1 @FlorinSzasz local screenW, screenH = guiGetScreenSize() addEvent("alarmSound", true) addEventHandler("alarmSound", localPlayer, function() sound = playSound3D("assets/sounds/alarm.mp3", 2310.35425, -7.48090, 26.74219, true) setSoundMaxDistance(sound, 150) end) addEvent("pBar", true) addEventHandler("pBar", localPlayer, function() function renderText() dxDrawText("Bomb Planting", 331, 505, 405, 528, tocolor(5, 229, 194, 255), 0.60, "bankgothic", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender", root, renderText) timeBar = 100 progBar = guiCreateProgressBar(screenW /2 -50 , screenH / 2 - 50 , 159, 34, false) setTimer(function() timeBar = timeBar - 6.66666666667 lastTime = timeBar guiProgressBarSetProgress(progBar, lastTime) if lastTime <= 0 then guiSetVisible(progBar, false) removeEventHandler("onClientRender", root, renderText) end end, 1000, 15) end) Edited June 8, 2023 by scolen
Shady1 Posted June 8, 2023 Posted June 8, 2023 local screenW, screenH = guiGetScreenSize() addEvent("alarmSound", true) addEventHandler("alarmSound", localPlayer, function() sound = playSound3D("assets/sounds/alarm.mp3", 2310.35425, -7.48090, 26.74219, true) setSoundMaxDistance(sound, 150) end) addEvent("pBar", true) addEventHandler("pBar", localPlayer, function() function renderText() dxDrawText("Bomb Planting", screenW * 0.14, screenH * 0.48, screenW * 0.22, screenH * 0.51, tocolor(5, 229, 194, 255), 0.60, "bankgothic", "left", "top", false, false, false, false, false) end addEventHandler("onClientRender", root, renderText) local progressWidth = screenW * 0.2 local progressHeight = screenH * 0.03 local progressX = (screenW - progressWidth) / 2 local progressY = (screenH - progressHeight) / 2 progBar = guiCreateProgressBar(progressX, progressY, progressWidth, progressHeight, false) timeBar = 100 setTimer(function() timeBar = timeBar - 6.66666666667 lastTime = timeBar guiProgressBarSetProgress(progBar, lastTime) if lastTime <= 0 then guiSetVisible(progBar, false) removeEventHandler("onClientRender", root, renderText) end end, 1000, 15) end) I didn't test it, but I edited the visible parts, if there are any other problems, let me know.
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