Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- require "base/internal/ui/reflexcore";
- muteOnWindowed = {canPosition = false;};
- registerWidget("muteOnWindowed")
- local preFullscreen
- local preVolume = consoleGetVariable("s_volume")
- function muteOnWindowed:initialize()
- widgetCreateConsoleVariable("volume", "float", consoleGetVariable("s_volume"))
- widgetCreateConsoleVariable("wolume", "float", 0)
- end
- function muteOnWindowed:draw()
- local fullscreen = consoleGetVariable("r_fullscreen")
- local volume = consoleGetVariable("s_volume")
- -- changes volume with fullscreen
- if preFullscreen ~= fullscreen then
- if fullscreen == 1 then
- consolePerformCommand("s_volume " .. consoleGetVariable("ui_muteonwindowed_volume"))
- else
- consolePerformCommand("s_volume " .. consoleGetVariable("ui_muteonwindowed_wolume"))
- end
- preFullscreen = fullscreen
- end
- -- ensures if user changes volume it changes widget too
- if preVolume ~= volume then
- if fullscreen == 1 then
- consolePerformCommand("ui_muteonwindowed_volume " .. volume)
- else
- consolePerformCommand("ui_muteonwindowed_wolume " .. volume)
- end
- preVolume = volume
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement