ZPROJECT

Notifications

Par
Sören
v1.0.6

Notification dans le monde

zUI.DisplayPulsingNotification affiche une indication à une position précise :

lua
local coords = vector3(
    350.46109008789,
    932.27905273438,
    203.43138122559
)

Citizen.CreateThread(function()
    while true do
        Wait(0)

        local playerCoords = GetEntityCoords(PlayerPedId())

        if #(coords - playerCoords) < 3.0 then
            zUI.DisplayPulsingNotification(
                "E",
                "Interagir",
                coords,
                {}
            )
        end
    end
end)

Une indication peut être désactivée avec l’option IsDisabled :

lua
zUI.DisplayPulsingNotification(
    "",
    "",
    coords,
    {
        IsDisabled = true
    }
)

Notification classique

zUI.SendNotification affiche une notification avec un titre, un message et des médias facultatifs :

lua
zUI.SendNotification(
    "Interaction",
    "Vous avez appuyé sur E.",
    {},
    "https://i.postimg.cc/jSs6YGNh/ZProject-4.jpg",
    "https://i.postimg.cc/pdrDpzsh/ZBanner-Paypal.png"
)

Exemple avec une interaction

lua
Citizen.CreateThread(function()
    while true do
        Wait(0)

        local playerCoords = GetEntityCoords(PlayerPedId())

        if #(coords - playerCoords) < 3.0 then
            zUI.DisplayPulsingNotification("E", "Interagir", coords, {})

            if IsControlJustPressed(0, 51) then
                zUI.SendNotification(
                    "Interaction",
                    "Vous avez appuyé sur E.",
                    {}
                )
            end
        end
    end
end)

Note : le contrôle FiveM 51 correspond généralement à la touche d’interaction E.