Skip to content

Commit c02db6b

Browse files
committed
version 2 updates
1 parent ca75aef commit c02db6b

File tree

19 files changed

+1027
-356
lines changed

19 files changed

+1027
-356
lines changed

.github/assets/banner.png

567 KB
Loading

.github/assets/demo/keybind.gif

6.35 MB
Loading

.github/assets/demo/progress.gif

6.8 MB
Loading

.github/assets/demo/rtl.gif

5.47 MB
Loading

.github/assets/demo/status.gif

6.22 MB
Loading

.github/assets/demo/tip.gif

6.24 MB
Loading

.github/assets/demo1.gif

-5.78 MB
Binary file not shown.

.github/assets/demo2.gif

-4.25 MB
Binary file not shown.

README.md

Lines changed: 106 additions & 112 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,32 @@
22

33
<img src="./.github/assets/banner.png" alt="bln notify script - redm" width="100%" />
44
<div style="display: flex; justify-content: space-between;">
5-
<img src="./.github/assets/demo1.gif" alt="Image 1" width="45%" />
6-
<img src="./.github/assets/demo2.gif" alt="Image 2" width="45%" />
5+
<img src="./.github/assets/demo/status.gif" alt="Image 1" width="33%" />
6+
<img src="./.github/assets/demo/keybind.gif" alt="Image 2" width="33%" />
7+
<img src="./.github/assets/demo/progress.gif" alt="Image 3" width="33%" />
8+
</div>
9+
<div style="display: flex; justify-content: space-between;">
10+
<img src="./.github/assets/demo/tip.gif" alt="Image 1" width="45%" />
11+
<img src="./.github/assets/demo/rtl.gif" alt="Image 2" width="45%" />
712
</div>
813

914
A standalone, flexible, and customizable notification system for RedM servers.
1015

11-
[Video Preview](https://youtu.be/zwK8LLuFDVE)
16+
[Video Preview](https://youtu.be/qHOM49tz3QE)
1217

1318
## ✨ Features
1419

1520
- 🌐 RTL (Right-to-Left) support for multilingual notifications
1621
- 📚 Predefined templates for easily reusable notifications
1722
- 🧭 Support for all directions (9 placement options)
1823
- 📱 Responsive design for various screen sizes
19-
- 🎵 Customizable notification sounds.
24+
- 🎵 Customizable notification sounds
2025
- 🎛️ Support for both advanced and simple notifications
21-
- 🌈 Customizable colors for title and description
22-
- 🖼️ Option to use background or transparent notifications
23-
- 🎭 Flexible icon support (URL or game texture hashnames)
26+
- 🌈 Dynamic text coloring with inline color codes
27+
- 🖼️ Inline images in text using `~img:name~` syntax
28+
- ⌨️ Interactive key bindings with visual indicators
29+
- 📊 Progress indicators (bar and circle types)
30+
- 🎭 Flexible icon support (URL or local img name)
2431
- ⏱️ Customizable duration for each notification
2532
- 🔀 Adjustable content alignment (start, center, end)
2633
- 🎬 Animated entrance and exit effects
@@ -36,156 +43,143 @@ To send a notification from the client-side:
3643

3744
```lua
3845
TriggerEvent("bln_notify:send", options)
39-
40-
OR
41-
46+
-- OR
4247
TriggerEvent("bln_notify:send", options, template)
4348
```
4449

45-
#### Example
50+
#### Basic Example
4651
```lua
4752
TriggerEvent("bln_notify:send", {
48-
title = "Hello!",
49-
description = "This is a basic notification.",
53+
title = "~#ffcc00~Hello!~e~",
54+
description = "This is a ~red~basic~e~ notification with ~img:info~ icon.",
5055
icon = "generic_list",
5156
placement = "middle-right"
5257
})
5358

54-
OR
55-
5659
-- With Template
5760
TriggerEvent("bln_notify:send", {
5861
description = "This is a success template notification.",
5962
placement = "middle-right"
6063
}, "SUCCESS")
6164
```
6265

63-
### Server-Side Usage
64-
65-
To send a notification from the server-side:
66-
66+
#### Advanced Example with Progress and Key Actions
6767
```lua
68-
TriggerEvent("bln_notify:send", source, options)
69-
70-
OR
71-
72-
TriggerEvent("bln_notify:send", source, options, template)
73-
```
74-
75-
#### Example
76-
```lua
77-
TriggerEvent("bln_notify:send", source, {
78-
title = "Hello!",
79-
description = "This is a basic notification.",
80-
icon = "generic_list",
81-
placement = "middle-right"
68+
TriggerEvent("bln_notify:send", {
69+
title = "~#ffcc00~Advanced Example~e~",
70+
description = "Press ~key:E~ to accept or ~key:F6~ to decline",
71+
icon = "warning",
72+
placement = "middle-left",
73+
duration = 10000,
74+
progress = {
75+
enabled = true,
76+
type = 'circle', -- or 'bar'
77+
color = '#ffcc00'
78+
},
79+
keyActions = {
80+
['E'] = "accept", -- action name used when listen
81+
['F6'] = "decline"
82+
}
8283
})
83-
84-
OR
85-
86-
-- With Template
87-
TriggerEvent("bln_notify:send", source, {
88-
description = "This is a success template notification.",
89-
placement = "middle-right"
90-
}, "SUCCESS")
9184
```
9285

9386
### Notification Options
9487

95-
The `options` table can include the following properties:
96-
9788
| Option | Description | Default | Required/Optional |
9889
|--------|-------------|---------|-------------------|
9990
| placement | Position of the notification | "top-right" | Optional |
10091
| title | Title of the notification | "Notification" | Required |
10192
| description | Description text for the notification | null | Optional |
102-
| duration | Time in milliseconds before the notification is automatically removed | 5000 | Optional |
103-
| icon | Icon name (only icon name from `ui/imgs/icons/`) or full URL (external url or resource url) | null | Optional |
104-
| useBackground | Whether to use the background image | true | Optional |
105-
| contentAlignment | Alignment of the content | "start" | Optional |
93+
| duration | Time in milliseconds before auto-removal | 5000 | Optional |
94+
| icon | [Icon name]('./ui/assets/imgs/icons') or URL | null | Optional |
95+
| useBackground | Whether to use background image | true | Optional |
96+
| contentAlignment | Content alignment | "start" | Optional |
10697
| isRTL | Right-to-left text direction | false | Optional |
107-
| titleColor | Custom color for the title | undefined | Optional |
108-
| descriptionColor | Custom color for the description | undefined | Optional |
109-
| customSound | Custom notification sound, object takes two props `sound` and `soundSet` | sound=`INFO_HIDE`, soundSet=`Ledger_Sounds` | Optional |
110-
111-
NOTE: a list of sounds can be found [here](https://github.com/femga/rdr3_discoveries/blob/master/audio/frontend_soundsets/frontend_soundsets.lua)
112-
113-
### Templates
98+
| progress | Progress indicator options | null | Optional |
99+
| keyActions | Key binding actions | null | Optional |
100+
| customSound | Custom notification sound | Default sounds | Optional |
114101

115-
Predefined templates are available in the `Config.Templates` by default:
102+
### Key Actions & Event Handling
116103

117-
- `INFO`
118-
- `SUCCESS`
119-
- `ERROR`
120-
- `REWARD_MONEY`
121-
- `TIP`
122-
- `TIP_XP`
123-
- `TIP_GOLD`
124-
- `TIP_CASH`
104+
Key actions allow you to add interactive key bindings to your notifications. When a specified key is pressed, it triggers an event that you can listen to in your scripts.
125105

126-
You can use these templates by passing the template name as the second argument in the TriggerEvent call. You can create as many templates as you want in `config.lua` to easily reuse them later.
127-
128-
### Placement Options
129-
130-
Available placement options are:
106+
#### Basic Usage Example
107+
```lua
108+
-- Send notification with key actions
109+
TriggerEvent("bln_notify:send", {
110+
title = "Interaction Available",
111+
description = "Press ~key:E~ to interact or ~key:F6~ to cancel",
112+
duration = 10000,
113+
keyActions = {
114+
-- ['key_name'] = 'action_name'
115+
['E'] = "accept", -- 'accept' is the action name that will be triggered
116+
['F6'] = "decline" -- 'decline' is the action name
117+
}
118+
})
131119

132-
- "top-right"
133-
- "top-center"
134-
- "top-left"
135-
- "middle-right"
136-
- "middle-center"
137-
- "middle-left"
138-
- "bottom-right"
139-
- "bottom-center"
140-
- "bottom-left"
120+
-- Listen for key press events in your script
121+
RegisterNetEvent("bln_notify:keyPressed")
122+
AddEventHandler("bln_notify:keyPressed", function(action)
123+
if action == "accept" then
124+
print("accept key was pressed!")
125+
-- Do your accept logic here
126+
elseif action == "decline" then
127+
print("decline key was pressed!")
128+
-- Do your decline logic here
129+
end
130+
end)
131+
```
132+
- `key_name`: The key names are specific to RedM's key mapping system. Make sure to use the correct key names in your `keyActions` configuration, list of allowed keys can be found at `client/keys.lua`.
133+
- `action_name`
134+
- Key icons: to show key icon in a notification description, use as `~key:name~`. The `name` can be anything like `E`, `ENTER`, `<-` ..etc. Its only a text in view, so it does not affect the key actions above if we put anything.
141135

142-
### Content Alignment Options
143136

144-
Available content alignment options are:
137+
### Progress Options
138+
```lua
139+
progress = {
140+
enabled = true, -- Enable/disable progress indicator
141+
type = 'bar', -- 'bar' or 'circle with countdown'
142+
color = '#ffcc00' -- Custom color for progress
143+
}
144+
```
145145

146-
- "start"
147-
- "center"
148-
- "end"
146+
### Text Formatting
147+
Can add color anywhere in your text (title or description).
148+
#### Color Formatting
149+
- Named colors: `~red~colored text~e~`
150+
- Hex colors: `~#ffcc00~colored text~e~`
149151

150-
### Advanced Example
152+
#### Image Formatting
153+
You can add inline images/icons to notification's description as follows:
154+
- [Icon name]('./ui/assets/imgs/icons') or URL, e.g. `~img:icon_name~` or `~img:full_url~`,
151155

152-
```lua
153-
-- Advanced Customizations
154-
TriggerEvent("bln_notify:send", {
155-
title = "Custom Notification",
156-
description = "This notification has custom styling.",
157-
icon = "generic_bundle_crafting",
158-
placement = "middle-center",
159-
duration = 10000,
160-
useBackground = false,
161-
contentAlignment = "center",
162-
isRTL = true,
163-
titleColor = "#FF5733",
164-
descriptionColor = "rgba(255, 255, 255, 0.8)"
165-
})
166-
```
167-
These examples demonstrate different ways to use the BLN Notify system, including various placement options, custom colors, different icon specifications, and other available options.
168156

169-
### Demo Commands (examples)
157+
### Templates
170158

171-
The following commands are available for testing the notification system:
159+
Predefined templates available in `Config.Templates`:
160+
- `INFO`: Information notifications with blue styling
161+
- `SUCCESS`: Success messages with green styling
162+
- `ERROR`: Error messages with red styling
163+
- `REWARD_MONEY`: Reward notifications with gold styling
164+
- `TIP`: Simple tip notifications
165+
- `TIP_XP`, `TIP_GOLD`, `TIP_CASH`: Specialized tip notifications
172166

173-
- `/bln_notify_allAdvanced [RTL]`: Show notifications in all placements
174-
- `/bln_notify_allTips [RTL] [icon]`: Show tip notifications in all placements
175-
- `/bln_notify_info [placement]`: Show an INFO notification
176-
- `/bln_notify_success [placement]`: Show a SUCCESS notification
177-
- `/bln_notify_error [placement]`: Show an ERROR notification
178-
- `/bln_notify [placement]`: Show a custom notification
179-
- `/bln_notify_tip [placement] [icon]`: Show a TIP notification
180-
- `/bln_notify_template [templateName] [title] [description]`: Show notification from template.
167+
### Demo Commands
181168

182-
These commands are defined in the `client/_Examples.lua` file and include chat suggestions for ease of use.
169+
Test commands available in game:
170+
- `/bln_notify_allAdvanced [RTL]`: Show all placement demos
171+
- `/bln_notify_allTips [RTL] [icon]`: Show all tip types
172+
- `/bln_notify_progress [type]`: Show progress notification
173+
- `/bln_notify_key`: Show key binding notification
174+
- `/bln_notify_template [template] [title] [desc]`: Test templates
175+
- `/bln_notify [RTL] [title] [desc] [icon] [placement]`: Custom notification
183176

177+
[Previous sections about placement options, content alignment, etc. remain the same...]
184178

185179
## Support
186180

187-
If you encounter any issues or have questions, go to [Discord for help](discord.com/invite/MEZRYQVpnt) or open an issue on the GitHub repository.
181+
For help and support, join our [Discord](discord.com/invite/MEZRYQVpnt) or create an issue on GitHub.
188182

189183
## Contributing
190184

191-
Contributions to improve the resource are welcome. Please feel free to submit pull requests or create issues for bugs and feature requests.
185+
Contributions are welcome! Feel free to submit pull requests or create issues for bugs and features.

0 commit comments

Comments
 (0)