Toastify

The Toastify plugin is a tool that creates temporary notifications on the user’s screen, used to facilitate messages between plugins and server users.

CONSOLE COMMANDS

toastify [toast_id] [player] [message] – to send a toast notification for a specific player
toastify.global [toast_id] [message] – to send a toast notification for everyone

PERMISSION of Toastify

toastify.use- the permission to access the toastify commands

API

// Send a toast notification for the target player
// Returns the ID of the toast to destroy it if necessary
string SendToast(BasePlayer player, string toastId, string message, float? duration);

// Destroy a toast notification
void DestroyToast(BasePlayer player, string toastId);

GOOD WAY TO IMPLEMENT

If you want to integrate your plugin with Toastify, I recommend that you add an option in the configuration file of your plugin that the user can link their notification ID with the notifications you will use, you can see an example of how this was implemented in the FurnaceUpgrades or TCLevels configuration file.

CONFIGURATION

The default configuration file of the plugin:

{
    "General": {
        "Render layer": "Overlay",
        "Float side (left or right)": "right",
        "Max toasts in the screen": 8,
        "Margin X": 24.0,
        "Margin top": 24.0,
        "Spacing between toasts": 6.0
    },
    "Toasts": {
        "success": {
            "Default duration": 10.0,
            "Width": 260.0,
            "Height": 60.0,
            "Background": {
                "Color": "#5b7038",
                "Opacity": 1.0,
                "Image URL": null,
                "Material": "assets/content/ui/uibackgroundblur-ingamemenu.mat",
                "Sprite": null,
                "Decorations": [
                    {
                        "Width": 60.0,
                        "Height": 60.0,
                        "Position X": 0.0,
                        "Position Y": 0.0,
                        "Background color": "0 0 0 0.4",
                        "Image URL": null
                    }
                ]
            },
            "Icon settings": {
                "Url": "assets/icons/check.png",
                "Color": "#c4ff61",
                "Size": 28.0,
                "Position X": 16.0,
                "Position Y": 16.0
            },
            "Title settings": {
                "Lang key": "ToastSuccessTitle",
                "Text align (combination with: 'top middle bottom' and 'left center right')": "middle left",
                "Font": null,
                "Font size": 14,
                "Width": 176.0,
                "Height": 18.0,
                "Position X": 72.0,
                "Position Y": 36.0
            },
            "Text settings": {
                "Text align (combination with: 'top middle bottom' and 'left center right')": "top left",
                "Font": "robotocondensed-regular.ttf",
                "Font size": 11,
                "Width": 176.0,
                "Height": 28.0,
                "Position X": 72.0,
                "Position Y": 6.0
            },
            "Close on click?": true,
            "Command on click": null,
            "Effect prefab": "assets/prefabs/locks/keypad/effects/lock.code.unlock.prefab"
        },
        "error": {
            "Default duration": 10.0,
            "Width": 260.0,
            "Height": 60.0,
            "Background": {
                "Color": "#cd412b",
                "Opacity": 1.0,
                "Image URL": null,
                "Material": "assets/content/ui/uibackgroundblur-ingamemenu.mat",
                "Sprite": null,
                "Decorations": [
                    {
                        "Width": 60.0,
                        "Height": 60.0,
                        "Position X": 0.0,
                        "Position Y": 0.0,
                        "Background color": "0 0 0 0.4",
                        "Image URL": null
                    }
                ]
            },
            "Icon settings": {
                "Url": "assets/icons/close.png",
                "Color": "#ff9989",
                "Size": 28.0,
                "Position X": 16.0,
                "Position Y": 16.0
            },
            "Title settings": {
                "Lang key": "ToastErrorTitle",
                "Text align (combination with: 'top middle bottom' and 'left center right')": "middle left",
                "Font": null,
                "Font size": 14,
                "Width": 176.0,
                "Height": 18.0,
                "Position X": 72.0,
                "Position Y": 36.0
            },
            "Text settings": {
                "Text align (combination with: 'top middle bottom' and 'left center right')": "top left",
                "Font": "robotocondensed-regular.ttf",
                "Font size": 11,
                "Width": 176.0,
                "Height": 28.0,
                "Position X": 72.0,
                "Position Y": 6.0
            },
            "Close on click?": true,
            "Command on click": null,
            "Effect prefab": "assets/prefabs/weapons/toolgun/effects/repairerror.prefab"
        }
    },
    "Debug mode": false
}

SCREENSHOT

Leave a Comment