-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathclient.lua
More file actions
87 lines (81 loc) · 2.42 KB
/
client.lua
File metadata and controls
87 lines (81 loc) · 2.42 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
local blackBars = false
local barHeight = 0.0
local targetHeight = 0.0
local transitionSpeed = 0.005
-- Open the blackbars menu
RegisterCommand("blackbars", function()
lib.registerContext({
id = 'blackbars_menu',
title = 'Cinematic Blackbars',
options = {
{
title = 'Low',
description = 'Small bars',
icon = 'film',
onSelect = function()
setBlackBars(true, 0.05)
end,
},
{
title = 'Medium',
description = 'Medium bars',
icon = 'film',
onSelect = function()
setBlackBars(true, 0.10)
end,
},
{
title = 'High',
description = 'Tall bars',
icon = 'film',
onSelect = function()
setBlackBars(true, 0.15)
end,
},
{
title = 'Remove',
icon = 'x',
description = 'Remove blackbars',
onSelect = function()
setBlackBars(false)
end,
},
}
})
lib.showContext('blackbars_menu')
end)
function setBlackBars(state, height)
blackBars = state
if state then
targetHeight = height
DisplayRadar(false)
else
targetHeight = 0.0
DisplayRadar(true)
end
end
-- Draw cinematic blackbars
CreateThread(function()
while true do
Wait(0)
if blackBars or barHeight > 0.0 then
-- Animate the bars up/down
if math.abs(barHeight - targetHeight) > 0.001 then
if barHeight < targetHeight then
barHeight = barHeight + transitionSpeed
if barHeight > targetHeight then barHeight = targetHeight end
else
barHeight = barHeight - transitionSpeed
if barHeight < targetHeight then barHeight = targetHeight end
end
end
-- Hide HUD elements
HideHudAndRadarThisFrame()
-- Draw top and bottom black bars
DrawRect(0.5, 0.0 + barHeight / 2, 1.0, barHeight, 0, 0, 0, 255)
DrawRect(0.5, 1.0 - barHeight / 2, 1.0, barHeight, 0, 0, 0, 255)
else
Wait(100)
end
end
end)