Skip to content

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.

ParametreTypeDescription
textstringMessage a afficher

Retour : true


tw.notif.rightError(text)

Notification rouge avec une icone de croix et un son negatif.

ParametreTypeDescription
textstringMessage 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.

ParametreTypePar defautDescription
textstringMessage a afficher
dictstringDictionnaire de texture
iconstringNom de l'icone
colorstring?"COLOR_WHITE"Couleur du texte
durationinteger?3000Duree en ms
soundset_refstring?"Transaction_Feed_Sounds"Reference du jeu de sons
soundset_namestring?"Transaction_Positive"Nom du son

tw.notif.left(title, text, dict, icon, color?, duration?, soundset_ref?, soundset_name?)

Notification cote gauche avec un titre.

ParametreTypePar defautDescription
titlestringLigne de titre
textstringCorps du message
dictstringDictionnaire de texture
iconstringNom de l'icone
colorstring?"COLOR_WHITE"Couleur du texte
durationinteger?3000Duree en ms
soundset_refstring?"Transaction_Feed_Sounds"Reference du jeu de sons
soundset_namestring?"Transaction_Positive"Nom du son

tw.notif.simpleTop(title, subtitle, duration?)

Grande notification en bandeau superieur (style debut/fin de mission).

ParametreTypePar defautDescription
titlestringTitre principal
subtitlestringSous-titre
durationinteger?3000Duree 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

  • rightSuccess et rightError sont des raccourcis pratiques. Utilisez right() 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.
  • rightSuccess retourne toujours true et rightError retourne toujours false, ce qui est utile pour les retours en ligne :
    lua
    if not hasItem then return tw.notif.rightError("Missing item") end

Premium RedM Scripts — Multi-Framework