You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Predefined templates are available in the `Config.Templates` by default:
102
+
### Key Actions & Event Handling
116
103
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.
125
105
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
-`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.
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~`
149
151
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~`,
151
155
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.
168
156
169
-
### Demo Commands (examples)
157
+
### Templates
170
158
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
172
166
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
181
168
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
0 commit comments