Home PendingToast
Post
Cancel

PendingToast

Background

PendingToast is a project that aims to create a simple method of sending toast notifications to your players.

Playing on different servers it becomes apparent that new players may struggle understanding nuances about certain scripts. For example, they may question why they can’t open a certain door as a civilian. No longer! With PendingToast, you can let them know that they can’t open the door because they aren’t on duty in a simple, effective manner.

Try it Out!

Try it out at PendingDevelopment’s Tebex Webstore.


Send a Notification

  1. Add PendingToast to your resources folder.
  2. Add ensure PendingToast to your server.cfg.
  3. Use events described below.
  4. If you require use of PendingSound, install as described here

Exports

Notify - From Client

1
TriggerEvent("PendingToast:Notify", NotificationOptions, SoundInfo)

E.G.:
Src: 1
NotificationOptions: See below…
SoundInfo: See below…

Notify - From Client to Server to Another Client

1
TriggerServerEvent("PendingToast:Notify", Src, NotificationOptions, SoundInfo)

E.G.:
Src: 1
NotificationOptions: See below…
SoundInfo: See below…

Notify - From Server to Client

1
TriggerClientEvent("PendingToast:Notify", Src, NotificationOptions, SoundInfo)

E.G.:
Src: 1
NotificationOptions: See below…
SoundInfo: See below…

Notify - Presets

As a simple starter, we’ve implemented some default presets. Feel free to use them, or create your own!

1
2
3
TriggerEvent("PendingToast:Success", NotificationOptions, SoundInfo)
TriggerClientEvent("PendingToast:Success", Src, NotificationOptions, SoundInfo)
TriggerServerEvent("PendingToast:Success", Src, NotificationOptions, , SoundInfo)

All default presets:

  • PendingToast:Success
  • PendingToast:Info
  • PendingToast:Error

NotificationOptions

Object KeyExample InputDefault Input (If left blank)
Text“This is a notification!”“PendingDevelopment”
LengthInSeconds105
BarColour“green” or “#ffffff”undefined
ImageURL“https://pendingmitch.dev/assets/img/Icon.png”“imgs/PendingDevelopment.svg”
RoundedBackgroundtruefalse

SoundInfo

The SoundInfo object relates PendingToast to PendingSound. Note that is this is left undefined, or Resource or Sound values aren’t set, PendingToast will nto attempt to call PendingSound. In addition, if PendingSound is not started PendingToast will not attempt to call PendingSound.

Object KeyExample InputDefault Input (If left blank)
ResourceGetCurrentResourceName() 
Sound“sounds/MySound.mp3” 
Volume0.51

For use in JavaScript and C# see FiveM’s Triggering Events page.

This post is licensed under CC BY 4.0 by the author.