[Release] Scaleform

lua
scaleform
gui

#1

Scaleform

Simple and easy-to-use module for Scaleform GUI.
You can use it as a separate resource or just add the file to your client_scripts.

Usage Example
local buttons = {
    { input = '~INPUT_CELLPHONE_LEFT~',  text = "Previous Player" },
    { input = '~INPUT_CELLPHONE_RIGHT~', text = "Next Player" },
}

local scaleform = Scaleform:Request('INSTRUCTIONAL_BUTTONS')
for i = 1, #buttons do
	scaleform:Call('SET_DATA_SLOT', i - 1, buttons[i].input, buttons[i].text)
end
scaleform:Call('DRAW_INSTRUCTIONAL_BUTTONS')

while true do
    Citizen.Wait(0)
    scaleform:RenderFullscreen()
end
API
Scaleform:Request(id) -- async
Scaleform:Delete()
Scaleform:Call(func, ...) -- use string, number or boolean parameters
Scaleform:Render(x, y, w, h, r, g, b, a)
Scaleform:RenderFullscreen(r, g, b, a)
Scaleform:RenderTimed(ms, x, y, w, h, r, g, b, a) -- async
Scaleform:RenderFullscreenTimed(ms, r, g, b, a) -- async

Helpful Resources

Scaleform Wiki
Scaleforms + Functions List

Links

Read and Comment
Download


#2

Updated

  • Used simple Lua class implementation for more friendly API
  • Added timeout parameter to Scaleform:Request() to prevent infinite while-true loop

#3

There no need for a timeout parameter, check the handle instead…

function LoadScaleForm(scaleform)
	local scaleform = RequestScaleformMovie(scaleform)
	if scaleform ~= 0 then
		while not HasScaleformMovieLoaded(scaleform) do
			Citizen.Wait(0)
		end
	end
	return scaleform
end

#4

Updated

  • Added Scaleform:RenderTimed and Scaleform:RenderFullscreenTimed API
  • Improved log format and code style

#5

is it possible to stream a scaleform serverside? i mean i want to show the breakingnews scaleform to everyone in the server when a robbery is in progress… is it possible?


#6

I think you should use something like TriggerClientEvent('showBreakingNews', -1).


#7

There’s a way to add a “loading icon/text” on the bottom right of the screen? While the player is doing something (esx).


#8

I solved it already but thanks


#9

Project is suspended

There could be updates after OneSync release.