tw.notif
Cote : Client + Server
Notifications natives RedM : panneau droit, panneau gauche et bandeau superieur.
Fonctions Client
tw.notif.rightSuccess(text)
Notification verte avec une icone de validation et un son positif.
| Parametre | Type | Description |
|---|---|---|
text | string | Message a afficher |
Retour : true
tw.notif.rightError(text)
Notification rouge avec une icone de croix et un son negatif.
| Parametre | Type | Description |
|---|---|---|
text | string | Message a afficher |
Retour : false
tw.notif.right(text, dict, icon, color?, duration?, soundset_ref?, soundset_name?)
Notification complete cote droit avec icone et son personnalises.
| Parametre | Type | Par defaut | Description |
|---|---|---|---|
text | string | — | Message a afficher |
dict | string | — | Dictionnaire de texture |
icon | string | — | Nom de l'icone |
color | string? | "COLOR_WHITE" | Couleur du texte |
duration | integer? | 3000 | Duree en ms |
soundset_ref | string? | "Transaction_Feed_Sounds" | Reference du jeu de sons |
soundset_name | string? | "Transaction_Positive" | Nom du son |
tw.notif.left(title, text, dict, icon, color?, duration?, soundset_ref?, soundset_name?)
Notification cote gauche avec un titre.
| Parametre | Type | Par defaut | Description |
|---|---|---|---|
title | string | — | Ligne de titre |
text | string | — | Corps du message |
dict | string | — | Dictionnaire de texture |
icon | string | — | Nom de l'icone |
color | string? | "COLOR_WHITE" | Couleur du texte |
duration | integer? | 3000 | Duree en ms |
soundset_ref | string? | "Transaction_Feed_Sounds" | Reference du jeu de sons |
soundset_name | string? | "Transaction_Positive" | Nom du son |
tw.notif.simpleTop(title, subtitle, duration?)
Grande notification en bandeau superieur (style debut/fin de mission).
| Parametre | Type | Par defaut | Description |
|---|---|---|---|
title | string | — | Titre principal |
subtitle | string | — | Sous-titre |
duration | integer? | 3000 | Duree en ms |
Fonctions Server
Les fonctions cote serveur ont la meme API que celles du client, mais avec source comme premier parametre. La notification est envoyee au joueur specifie.
tw.notif.rightSuccess(source, text)
tw.notif.rightError(source, text)
tw.notif.right(source, text, dict, icon, color?, duration?, soundset_ref?, soundset_name?)
tw.notif.left(source, title, text, dict, icon, color?, duration?, soundset_ref?, soundset_name?)
tw.notif.simpleTop(source, title, subtitle, duration?)
tw.notif.print(source, ...)
Affiche un message dans la console client (F8) du joueur cible.
Exemples
Notifications cote client
lua
-- Notification de succes (verte, cote droit)
tw.notif.rightSuccess("You found 3x Apple")
-- Notification d'erreur (rouge, cote droit)
tw.notif.rightError("Not enough inventory space")
-- Notification gauche personnalisee avec icone d'alerte
tw.notif.left("Sheriff Office", "A crime has been reported", "menu_textures", "menu_icon_alert", "COLOR_RED")
-- Bandeau superieur (style mission)
tw.notif.simpleTop("Mission Complete", "You earned $50")Notifications cote serveur
lua
-- Envoyer une notification de succes a un joueur specifique
tw.notif.rightSuccess(source, "Item added to inventory")
-- Envoyer une notification d'erreur
tw.notif.rightError(source, "You don't have enough money")
-- Afficher dans la console du joueur
tw.notif.print(source, "Debug: player data loaded")Notes
rightSuccessetrightErrorsont des raccourcis pratiques. Utilisezright()pour un controle complet sur l'icone, la couleur et le son.- Les fonctions cote serveur declenchent un evenement client en interne, donc le joueur doit etre connecte.
rightSuccessretourne toujourstrueetrightErrorretourne toujoursfalse, ce qui est utile pour les retours en ligne :luaif not hasItem then return tw.notif.rightError("Missing item") end

