Skip to content

Commit 75e4ba3

Browse files
committed
xd
1 parent 426c910 commit 75e4ba3

File tree

50 files changed

+8833
-331
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+8833
-331
lines changed

advert/docs/hooks.md

Lines changed: 87 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,87 @@
1+
# Advertisements Module Hooks
2+
3+
Hooks provided by the Advertisements module for server-wide announcements.
4+
5+
---
6+
7+
Overview
8+
9+
The Advertisements module provides a paid server-wide announcement system that allows players to broadcast messages to all connected players. It implements spam prevention through cooldowns, message logging for administrative oversight, and colored message formatting for better visibility. The module integrates with the economy system for paid advertisements and includes comprehensive hook support for customizing advertisement behavior, validation, and processing workflows.
10+
11+
---
12+
13+
### AdvertSent
14+
15+
#### 📋 Purpose
16+
Called when a player successfully sends an advertisement message to the server.
17+
18+
#### ⏰ When Called
19+
After an advertisement has been sent, logged, and displayed to all players.
20+
21+
#### ⚙️ Parameters
22+
23+
| Parameter | Type | Description |
24+
|-----------|------|-------------|
25+
| `client` | **Player** | The player who sent the advertisement |
26+
| `message` | **string** | The advertisement message content |
27+
28+
#### ↩️ Returns
29+
nil
30+
31+
#### 🌐 Realm
32+
Server
33+
34+
#### 💡 Example Usage
35+
36+
#### 🔰 Low Complexity
37+
```lua
38+
hook.Add("AdvertSent", "LogAdvertisements", function(client, message)
39+
print(client:Name() .. " sent an advertisement: " .. message)
40+
end)
41+
```
42+
43+
#### 📊 Medium Complexity
44+
```lua
45+
hook.Add("AdvertSent", "TrackAdvertisementStats", function(client, message)
46+
if not client.advertCount then client.advertCount = 0 end
47+
client.advertCount = client.advertCount + 1
48+
49+
-- Track advertisement length
50+
local stats = client:getNetVar("advertStats", {})
51+
stats.totalLength = (stats.totalLength or 0) + #message
52+
stats.count = client.advertCount
53+
client:setNetVar("advertStats", stats)
54+
end)
55+
```
56+
57+
#### ⚙️ High Complexity
58+
```lua
59+
hook.Add("AdvertSent", "AdvancedAdvertisementSystem", function(client, message)
60+
-- Store advertisement in database
61+
local char = client:getChar()
62+
if char then
63+
lia.db.insert("advertisements", {
64+
steamid = client:SteamID(),
65+
charid = char:getID(),
66+
message = message,
67+
timestamp = os.time()
68+
})
69+
end
70+
71+
-- Check for special keywords and trigger events
72+
local keywords = {"sale", "wanted", "hiring", "selling"}
73+
for _, keyword in ipairs(keywords) do
74+
if string.find(string.lower(message), keyword) then
75+
hook.Run("AdvertKeywordTriggered", client, keyword, message)
76+
end
77+
end
78+
79+
-- Send notification to admins
80+
for _, admin in player.Iterator() do
81+
if admin:IsAdmin() then
82+
admin:notify(client:Name() .. " sent: " .. message)
83+
end
84+
end
85+
end)
86+
```
87+

alcoholism/docs/hooks.md

Lines changed: 240 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,240 @@
1+
# Alcoholism Module Hooks
2+
3+
Hooks provided by the Alcoholism module for managing blood alcohol content (BAC) and alcohol consumption effects.
4+
5+
---
6+
7+
Overview
8+
9+
The Alcoholism module implements a comprehensive intoxication system where players can consume alcoholic beverages that progressively increase their Blood Alcohol Content (BAC). As BAC rises, players experience visual impairments like screen blurring, movement slowdown, and other debilitating effects. The system includes BAC thresholds for different intoxication levels, automatic metabolism over time, and extensive hook integration for customizing alcohol effects, consumption mechanics, and sobriety recovery processes.
10+
11+
---
12+
13+
### AlcoholConsumed
14+
15+
#### 📋 Purpose
16+
Called when a player consumes an alcohol item.
17+
18+
#### ⏰ When Called
19+
After a player successfully drinks an alcohol item and their BAC has been increased.
20+
21+
#### ⚙️ Parameters
22+
23+
| Parameter | Type | Description |
24+
|-----------|------|-------------|
25+
| `client` | **Player** | The player who consumed the alcohol |
26+
| `item` | **Item** | The alcohol item that was consumed |
27+
28+
#### ↩️ Returns
29+
nil
30+
31+
#### 🌐 Realm
32+
Server
33+
34+
---
35+
36+
### BACChanged
37+
38+
#### 📋 Purpose
39+
Called whenever a player's blood alcohol content (BAC) value changes.
40+
41+
#### ⏰ When Called
42+
After the BAC value has been updated on the server, whether it increased or decreased.
43+
44+
#### ⚙️ Parameters
45+
46+
| Parameter | Type | Description |
47+
|-----------|------|-------------|
48+
| `client` | **Player** | The player whose BAC changed |
49+
| `newBac` | **number** | The new BAC value (0-100) |
50+
51+
#### ↩️ Returns
52+
nil
53+
54+
#### 🌐 Realm
55+
Server
56+
57+
---
58+
59+
### BACIncreased
60+
61+
#### 📋 Purpose
62+
Called when a player's BAC value increases.
63+
64+
#### ⏰ When Called
65+
After BAC has been increased but before BACChanged is called.
66+
67+
#### ⚙️ Parameters
68+
69+
| Parameter | Type | Description |
70+
|-----------|------|-------------|
71+
| `client` | **Player** | The player whose BAC increased |
72+
| `oldBac` | **number** | The previous BAC value |
73+
| `newBac` | **number** | The new BAC value |
74+
75+
#### ↩️ Returns
76+
nil
77+
78+
#### 🌐 Realm
79+
Server
80+
81+
---
82+
83+
### BACReset
84+
85+
#### 📋 Purpose
86+
Called when a player's BAC is reset to zero.
87+
88+
#### ⏰ When Called
89+
After BAC has been reset, typically when a character is loaded or respawns.
90+
91+
#### ⚙️ Parameters
92+
93+
| Parameter | Type | Description |
94+
|-----------|------|-------------|
95+
| `client` | **Player** | The player whose BAC was reset |
96+
97+
#### ↩️ Returns
98+
nil
99+
100+
#### 🌐 Realm
101+
Server
102+
103+
---
104+
105+
### BACThresholdReached
106+
107+
#### 📋 Purpose
108+
Called when a player's BAC reaches a specific threshold level.
109+
110+
#### ⏰ When Called
111+
When BAC crosses a defined threshold value (e.g., 30%, 50%, 80%).
112+
113+
#### ⚙️ Parameters
114+
115+
| Parameter | Type | Description |
116+
|-----------|------|-------------|
117+
| `client` | **Player** | The player who reached the threshold |
118+
| `bac` | **number** | The current BAC value |
119+
| `threshold` | **number** | The threshold that was reached |
120+
121+
#### ↩️ Returns
122+
nil
123+
124+
#### 🌐 Realm
125+
Server
126+
127+
---
128+
129+
### PostBACDecrease
130+
131+
#### 📋 Purpose
132+
Called after a player's BAC has been decreased during the degradation cycle.
133+
134+
#### ⏰ When Called
135+
After BAC degradation has been processed and the new value has been set.
136+
137+
#### ⚙️ Parameters
138+
139+
| Parameter | Type | Description |
140+
|-----------|------|-------------|
141+
| `client` | **Player** | The player whose BAC decreased |
142+
| `newBac` | **number** | The new BAC value after decrease |
143+
144+
#### ↩️ Returns
145+
nil
146+
147+
#### 🌐 Realm
148+
Server
149+
150+
---
151+
152+
### PostBACReset
153+
154+
#### 📋 Purpose
155+
Called after a player's BAC has been reset to zero.
156+
157+
#### ⏰ When Called
158+
After BAC reset has been completed.
159+
160+
#### ⚙️ Parameters
161+
162+
| Parameter | Type | Description |
163+
|-----------|------|-------------|
164+
| `client` | **Player** | The player whose BAC was reset |
165+
166+
#### ↩️ Returns
167+
nil
168+
169+
#### 🌐 Realm
170+
Server
171+
172+
---
173+
174+
### PreBACDecrease
175+
176+
#### 📋 Purpose
177+
Called before a player's BAC is decreased during the degradation cycle.
178+
179+
#### ⏰ When Called
180+
Before BAC degradation is processed, allowing modification of the decrease rate.
181+
182+
#### ⚙️ Parameters
183+
184+
| Parameter | Type | Description |
185+
|-----------|------|-------------|
186+
| `client` | **Player** | The player whose BAC will decrease |
187+
| `bac` | **number** | The current BAC value before decrease |
188+
189+
#### ↩️ Returns
190+
nil
191+
192+
#### 🌐 Realm
193+
Server
194+
195+
---
196+
197+
### PreBACIncrease
198+
199+
#### 📋 Purpose
200+
Called before a player's BAC is increased from consuming alcohol.
201+
202+
#### ⏰ When Called
203+
Before BAC increase is processed, allowing modification of the increase amount.
204+
205+
#### ⚙️ Parameters
206+
207+
| Parameter | Type | Description |
208+
|-----------|------|-------------|
209+
| `client` | **Player** | The player whose BAC will increase |
210+
| `item` | **Item** | The alcohol item being consumed |
211+
| `amount` | **number** | The amount of BAC to add |
212+
213+
#### ↩️ Returns
214+
nil or **number** - Return a modified amount to override the increase
215+
216+
#### 🌐 Realm
217+
Server
218+
219+
---
220+
221+
### PreBACReset
222+
223+
#### 📋 Purpose
224+
Called before a player's BAC is reset to zero.
225+
226+
#### ⏰ When Called
227+
Before BAC reset is processed, allowing cancellation of the reset.
228+
229+
#### ⚙️ Parameters
230+
231+
| Parameter | Type | Description |
232+
|-----------|------|-------------|
233+
| `client` | **Player** | The player whose BAC will be reset |
234+
235+
#### ↩️ Returns
236+
nil or **boolean** - Return false to prevent reset
237+
238+
#### 🌐 Realm
239+
Server
240+

0 commit comments

Comments
 (0)