FiveM Docs
es_extendedClientModules

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

Resourcees_extended (implemented in esx_lib as xLib.scaleform)
SideClient

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.

NameTypeDescription
titlestringLarge title.
msgstringSubtitle.
secnumberDuration 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.

NameTypeDescription
titlestringScrolling ticker text.
msgstringMain headline.
bottomstringLine under the headline.
secnumberDuration 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.

NameTypeDescription
titlestringTitle.
msgstringMessage.
bottomstringFooter text.
secnumberDuration 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.

NameTypeDescription
secnumberDuration 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.

NameTypeDescription
moviestringMovie 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.

NameTypeDescription
scaleformnumber | stringHandle or movie name.
methodNamestringMethod to call.
returnValueboolean?When true, end with EndScaleformMovieMethodReturnValue.
...number | string | booleanMethod 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.

Frequently asked questions

Independent documentation

esx-fivem.com is a community project and is not affiliated with the ESX Framework team. Facts on this page were checked against the upstream source. Official resources: docs.esx-framework.org and github.com/esx-framework.
Edit on GitHub

Last updated on

On this page