-
Notifications
You must be signed in to change notification settings - Fork 50
HUD section
The API gives you two important HUD features: Markers and Notifications.
Markers are quite easy to handle, you create a marker and draw it.. the neat thing is that you won't need to use complex ways to get if the player is inside the marker or near it.. the API will tell you straight away with no big natives involving.. just simple old plain Math.
called via:
C#:
new Marker(MarkerType type, Vector3 position, float distance, Color color, bool placeOnGround = false, bool bobUpDown = false, bool rotate = false, bool faceCamera = false)
new Marker(MarkerType type, Vector3 position, Vector3 scale, float distance, Color color, bool placeOnGround = false, bool bobUpDown = false, bool rotate = false, bool faceCamera = false)
Lua:
Marker.New(type, position, scale, distance, color, placeOnGround, bobUpDown, rotate, faceCamera, checkZ)
The Marker has 2 bools you can check while it draws:
C#:
IsInMarker
IsInRange
Lua:
.IsInMarker
:IsInRange()
You can decide to draw the marker only at a certain distance, IsInRange
will tell you if your Ped is inside that distance range.
IsInMarker
is, as the name, a parameter that will tell you if your ped is inside the marker, if you set checkZ
to true the check will be made only if the ped is inside it counting the height too.. if false no matter the height, it will return true as long as the ped is in the marker.
Called via:
C# / Lua:
ScaleformUI.Notifications
Let's have a look at all the available notifications!
Pretty basic, it comes in 2 variants, with / without colors!
called via:
C#:
ShowNotification(string msg, bool blink = false, bool showBriefing = true)
ShowNotification(string msg, NotificationColor color, bool blink = false, bool showBriefing = true)
Lua:
:ShowNotification(msg, blink, showBrief)
:ShowNotificationWithColor(msg, color, blink, showBrief)
available colors are:
C#
public enum NotificationColor
{
Red = 27,
Yellow = 50,
Gold = 12,
GreenLight = 46,
GreenDark = 47,
Cyan = 48,
Blue = 51,
Purple = 49,
Rose = 45
}
Lua
Color = {
Red = 27,
Yellow = 50,
Gold = 12,
GreenLight = 46,
GreenDark = 47,
Cyan = 48,
Blue = 51,
Purple = 49,
Rose = 45
},
The cellphone-like notification, like the basic one, it can be colored too!
- For the colors you can refer to the notification above.
Called via:
C#:
ShowAdvancedNotification(string title, string subtitle, string text, string iconSet = "Default", string icon = "Default", HudColor bgColor = HudColor.NONE, Color flashColor = new Color(), bool blink = false, NotificationType type = NotificationType.Default, bool showInBrief = true, bool sound = true)
Lua:
ShowAdvancedNotification(title, subtitle, text, iconSet, icon, bgColor, flashColor, blink, type, sound)
This notification adds 2 more optional icons to the hud, the CHAR and the icon type.
CHAR is the sender icon, the type is the icon to add to the message:
- To a complete list of chars (too long to be shown here) please refer to IconChars in Notifications.lua / NotificationChars.cs C#
public enum NotificationType : int
{
Default = 0,
Bubble = 1,
Mail = 2,
FriendRequest = 3,
Default2 = 4,
Reply = 7,
ReputationPoints = 8,
Money = 9
}
Lua
Type = {
Default = 0,
Bubble = 1,
Mail = 2,
FriendRequest = 3,
Default2 = 4,
Reply = 7,
ReputationPoints = 8,
Money = 9
},
The classic help text shown in the top-left corner of the screen.
called via:
C#:
ShowHelpNotification(string helpText) // this needs to be called per frame
ShowHelpNotification(string helpText, int time) // this doesn't need to be called per frame!
Lua:
:ShowHelpNotification(helpText, time) -- if time is not specified this has to be called per frame, else just call it specifying the time
This is a more advanced help notification, it's the same as the other one but it's drawn in the 3D world instead of the corner of the screen.
Called via:
ShowFloatingHelpNotification(string msg, Vector3 coords, int time = -1)
Lua (needs to be called every frame):
:ShowFloatingHelpNotification(msg, coords)
local coords = GetEntityCoods(PlayerPedId())
local duration = 3000 -- In milliseconds
Citizen.CreateThread(function()
local display_notification = true
Citizen.SetTimeout(duration, function() display_notification = false end)
while display_notification do
Citizen.Wait(0)
Notifications:ShowFloatingHelpNotification("This message will be removed in 3 seconds", coords)
end
end)
This notification is used to show the advancement in a specific skill, can be something going forwards or backwards.
Called via:
ShowStatNotification(int newProgress, int oldProgress, string title, bool blink = false, bool showBrief = true)
Lua:
:ShowStatNotification(newProgress, oldProgress, title, blink, showBrief)
The notification used usually in GTA:O when someone keeps killng you or vice versa.
Called via:
ShowVSNotification(Ped otherPed, HudColor color1, HudColor color2) // this one sets Ped-1 as your own Ped
ShowVSNotification(Ped otherPed1, Ped otherPed2, HudColor color1, HudColor color2)
Lua:
:ShowVSNotification(ped1, ped2, color1, color2)
Used to draw simple text in the game world given 3D coords in a vector3.
Called via:
DrawText3D(string text, Vector3 coord, Color color, Font font = Font.ChaletComprimeCologne, float scale = 17f) // relative to the gameplay camera
DrawText3D(Camera camera, string text, Vector3 coord, Color color, Font font = Font.ChaletComprimeCologne, float scale = 17f) // relative to the given scripted camera
Lua:
:DrawText3D(coords, color, text, font, size)
To draw simple text on screen given x, y coords.
Called via:
DrawText(string text)
DrawText(float x, float y, string text)
DrawText(float x, float y, string text, Color color)
DrawText(float x, float y, string text, Color color, Font font)
DrawText(float x, float y, string text, Color color, Font font, Alignment TextAlignment)
DrawText(float x, float y, string text, Color color, Font font, Alignment TextAlignment, bool Shadow = false, bool Outline = false, float Wrap = 0)
Lua:
:DrawText(x, y, text, color, font, textAlignment, shadow, outline, wrap)
This will draw a subtitle in the bottom of the screen.. this function is an exclusive for lua as C# already implements this via Screen.ShowSubtitle
Called via:
Lua:
:ShowSubtitle(msg, time)