-
Notifications
You must be signed in to change notification settings - Fork 60
/
hints.lua
113 lines (94 loc) · 5.04 KB
/
hints.lua
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
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
local PLUGIN = PLUGIN
PLUGIN.name = "Hint System"
PLUGIN.description = "Adds hints which might help you every now and then."
PLUGIN.author = "Riggs Mackay"
PLUGIN.schema = "Any"
PLUGIN.license = [[
Copyright 2022 Riggs Mackay
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
]]
ix.lang.AddTable("english", {
optHints = "Toggle hints",
optHintsSound = "Toggle hints Sound",
optHintsDelay = "Hints delay",
optdHints = "Wether or not hints should be shown.",
optdHintsSound = "Wether or not hints should play a sound.",
optdHintsDelay = "The delay between hints.",
})
ix.option.Add("hints", ix.type.bool, true, {
category = "Hint System",
default = true,
})
ix.option.Add("hintsSound", ix.type.bool, true, {
category = "Hint System",
default = true,
})
ix.option.Add("hintsDelay", ix.type.number, 300, {
category = "Hint System",
min = 30,
max = 1800,
decimals = 1,
default = 300,
})
ix.hints = ix.hints or {}
ix.hints.stored = ix.hints.stored or {}
function ix.hints.Register(message)
table.insert(ix.hints.stored, message)
end
ix.hints.Register("Don't drink the water; they put something in it, to make you forget.")
ix.hints.Register("Bored? Try striking up a conversation with someone or creating a plot!")
ix.hints.Register("The staff are here to help you. Show respect and cooperate with them and everyone will benefit from it.")
ix.hints.Register("Running, jumping, and other uncivil actions can result in re-education by Civil Protection.")
ix.hints.Register("The Combine don't like it when you talk, so whisper.")
ix.hints.Register("Life is bleak in the city without companions. Go make some friends.")
ix.hints.Register("Remember: This is a roleplay server. You are playing as a character- not as yourself.")
ix.hints.Register("The city is under constant surveillance. Be careful.")
ix.hints.Register("Don't mess with the Combine, they took over Earth in 7 hours.")
ix.hints.Register("Cause too much trouble and you may find yourself without a ration, or worse.")
ix.hints.Register("Your designated inspection position is your room. Don't forget!")
ix.hints.Register("If you're looking for a way to get to a certain location, it's not a bad idea to ask for help.")
ix.hints.Register("Report crimes to Civil Protection to gain loyalty points on your record.")
ix.hints.Register("Type .// before your message to talk out of character locally.")
ix.hints.Register("Obey the Combine, you'll be glad that you did.")
ix.hints.Register("Civil Protection is protecting civilized society, not you.")
ix.hints.Register("Why don't you try cooking something every now and then? All you need is a stove and the right ingredients.")
ix.hints.Register("Don't piss off Civil Protection, or you'll find yourself being re-educated, or worse..")
if ( CLIENT ) then
surface.CreateFont("HintFont", {
font = "Arial",
size = 20,
weight = 500,
blursize = 0.5,
shadow = true,
})
local nextHint = 0
local hintEndRender = 0
local bInHint = false
local hint = nil
local hintShow = false
local hintAlpha = 0
function PLUGIN:HUDPaint()
if not ( ix.option.Get("hints", true) ) then return end
if ( nextHint < CurTime() ) then
hint = ix.hints.stored[math.random(#ix.hints.stored)]
nextHint = CurTime() + ( ix.option.Get("hintsDelay") or math.random(60,360) )
hintShow = true
hintEndRender = CurTime() + 15
if ( ix.option.Get("hintsSound", true) ) then
LocalPlayer():EmitSound("ui/hint.wav", 40, 100, 0.1)
end
end
if not ( hint ) then return end
if ( hintEndRender < CurTime() ) then
hintShow = false
end
if ( hintShow == true ) then
hintAlpha = Lerp(0.01, hintAlpha, 255)
else
hintAlpha = Lerp(0.01, hintAlpha, 0)
end
draw.DrawText(hint, "HintFont", ScrW() / 2, 0, ColorAlpha(color_white, hintAlpha), TEXT_ALIGN_CENTER)
end
end