Scaleform
ESX.Scaleform functions show GTA scaleforms like the wasted shard, breaking news and popup warnings, plus helpers to load movies and call scaleform methods.
ESX.Scaleform shows a few common GTA V scaleform screens with one call and gives you two helpers to work with any other scaleform movie. Use it for big on-screen announcements such as "WASTED"-style shards, a news ticker or a warning popup.
Overview
| Resource | es_extended (implemented in esx_lib as xLib.scaleform) |
| Side | Client |
The four Show* functions block the calling thread for sec seconds while they draw the movie every frame, then release it.
Functions
ESX.Scaleform.ShowFreemodeMessage
ESX.Scaleform.ShowFreemodeMessage(title, msg, sec)Shows the big centered shard of the MP_BIG_MESSAGE_FREEMODE movie.
| Name | Type | Description |
|---|---|---|
title | string | Large title. |
msg | string | Subtitle. |
sec | number | Duration in seconds. |
Returns: nothing
CreateThread(function()
ESX.Scaleform.ShowFreemodeMessage('~g~HEIST COMPLETE', 'You earned $50,000', 5)
end)ESX.Scaleform.ShowBreakingNews
ESX.Scaleform.ShowBreakingNews(title, msg, bottom, sec)Shows the Weazel News BREAKING_NEWS overlay.
| Name | Type | Description |
|---|---|---|
title | string | Scrolling ticker text. |
msg | string | Main headline. |
bottom | string | Line under the headline. |
sec | number | Duration in seconds. |
Returns: nothing
CreateThread(function()
ESX.Scaleform.ShowBreakingNews('Pacific Standard robbed', 'BANK ROBBERY', 'Police on scene', 10)
end)ESX.Scaleform.ShowPopupWarning
ESX.Scaleform.ShowPopupWarning(title, msg, bottom, sec)Shows the full-screen POPUP_WARNING alert.
| Name | Type | Description |
|---|---|---|
title | string | Title. |
msg | string | Message. |
bottom | string | Footer text. |
sec | number | Duration in seconds. |
Returns: nothing
CreateThread(function()
ESX.Scaleform.ShowPopupWarning('Server restart', 'The server restarts in 5 minutes.', 'Please finish your roleplay.', 8)
end)ESX.Scaleform.ShowTrafficMovie
ESX.Scaleform.ShowTrafficMovie(sec)Plays the TRAFFIC_CAM movie full screen.
| Name | Type | Description |
|---|---|---|
sec | number | Duration in seconds. |
Returns: nothing
Utils
ESX.Scaleform.Utils.RequestScaleformMovie
ESX.Scaleform.Utils.RequestScaleformMovie(movie)Requests a scaleform movie and waits until it is loaded. There is no timeout, so only use valid movie names.
| Name | Type | Description |
|---|---|---|
movie | string | Movie name, for example MIDSIZED_MESSAGE. |
Returns: number scaleform handle.
ESX.Scaleform.Utils.RunMethod
ESX.Scaleform.Utils.RunMethod(scaleform, methodName, returnValue, ...)Calls a method on a scaleform. If you pass a movie name instead of a handle, the movie is loaded first. Arguments are pushed by type: integers, floats, strings and booleans.
| Name | Type | Description |
|---|---|---|
scaleform | number | string | Handle or movie name. |
methodName | string | Method to call. |
returnValue | boolean? | When true, end with EndScaleformMovieMethodReturnValue. |
... | number | string | boolean | Method arguments. |
Returns: the scaleform handle, plus the return value handle when returnValue is true. You must release the movie yourself with SetScaleformMovieAsNoLongerNeeded.
CreateThread(function()
local scaleform = ESX.Scaleform.Utils.RunMethod('MIDSIZED_MESSAGE', 'SHOW_SHARD_MIDSIZED_MESSAGE', false, 'Shift started', 'Drive to the depot')
local endTime = GetGameTimer() + 4000
while GetGameTimer() < endTime do
DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255, 0)
Wait(0)
end
SetScaleformMovieAsNoLongerNeeded(scaleform)
end)Floats and integers are different in Lua 5.4. Write 500.0 when a scaleform method expects a float and 500 when it expects an integer.
Related
Frequently asked questions
Independent documentation
Last updated on
Interactions
Use ESX.RegisterInteraction, ESX.RemoveInteraction and ESX.GetInteractKey to bind world actions to the shared ESX interact key (E by default).
Streaming
ESX.Streaming loads models, animation dictionaries, anim sets, texture dictionaries, particle assets and weapon assets safely with a timeout in ESX Legacy.