Skip to main content

User Interface Module

Session::UserInterface() lets your plugin speak to the player through the client's own UI.

Notifications

Result ShowNotification( NotificationType type, std::string_view message );

Shows a toast-style notification that disappears after a few seconds. The message is UTF-8 and may be at most 200 characters; longer messages are rejected with Result::InvalidParameter.

Types select the visual style: Normal, Warning, Error, and Success.

g_session->UserInterface().ShowNotification(
TruckersMP::NotificationType::Success, "Route exported to clipboard" );

When to use which channel

ChannelAudienceUse for
ShowNotificationThe player, in gameShort, timely facts: "job saved", "hotkey enabled".
Core().LogMessageYou, and users reporting problemsDiagnostics and errors; see Core.
Your own overlayThe player, continuouslyAnything persistent or interactive; see Render.

Notifications share screen space with the client's own messages, so be sparing: a plugin that toasts every minor event trains players to ignore all notifications, including the client's.