Scaleform Wrapper - Use scaleforms neater and simpler!

This is a release specifically for developers, which should help out drastically when using scaleforms.
It is similar to the C# wrapper for scaleforms, but in Lua!

Example code with wrapper (Results in the same image on my scaleform documentation):

Citizen.CreateThread(function()
    local s = Scaleform.Request("mp_big_message_freemode")
    s:CallFunction("SHOW_SHARD_WASTED_MP_MESSAGE", "SOME TEXT", "SOME MORE TEXT", 5)
    while true do
        Citizen.Wait(0)
        s:Draw2D()
    end
end)

Without Wrapper:

Citizen.CreateThread(function()
    local scaleform = RequestScaleformMovie("mp_big_message_freemode")
    while not HasScaleformMovieLoaded(scaleform) do
        Citizen.Wait(0)
    end
    
    BeginScaleformMovieMethod(scaleform, "SHOW_SHARD_WASTED_MP_MESSAGE")
    PushScaleformMovieMethodParameterString("SOME TEXT")
    PushScaleformMovieMethodParameterString("SOME MORE TEXT")
    PushScaleformMovieMethodParameterInt(5)
    EndScaleformMovieMethod()

    while true do
        Citizen.Wait(0)
        DrawScaleformMovieFullscreen(scaleform, 255, 255, 255, 255)
    end
end)

Result:

https://images.illusivetea.me/2e34D3.jpg

Download it here (comes with an example in the resource, howver can be implemented into any script you wish, or just yoinked into some sort of helper resource):

Happy scaleforming!

20 Likes

Nice dude im going to test around a bit

3 Likes

Another great release tea. Great work.

1 Like

EPIC - Well done dad, awesome release.

1 Like

Great! Been waiting for you to release this, this will definetly speed up and simplify my shitty Scaleform methods! Hopefully we’ll also see more implementations of Scaleform in other releases.

1 Like

Thanks, a shame really, how little people use them at times, because they can be handy if you for example, arent too good at design, or infact, if you just want to go with that nice native look :stuck_out_tongue:

1 Like

Every server needs to use the instructional buttons scaleform.

2 Likes

this is the main reason i use scaleforms all the time ahahah, nice release :heart:

2 Likes

Great, when I saw it, I remembered that I had something like this.

In my code scaleform functions are dynamically called(?) based on the type of variable

Is old and not complete because I don’t check if the numbertype is float or int. Maybe someone will find that useful too

function Initialize(scaleform, sub, params)
	local scaleform = RequestScaleformMovie(scaleform)
	
    while not HasScaleformMovieLoaded(scaleform) do
        Citizen.Wait(0)
	end
	PushScaleformMovieFunction(scaleform, sub)
	for i = 1, #params do
		tp = type(params[i])
		_G["PushScaleformMovieFunctionParameter" .. tp:sub(1,1):upper()..tp:sub(2)](params[i])
	end
	PopScaleformMovieFunctionVoid()
	
    return scaleform
end
Usage example
Citizen.CreateThread(function()
    params = {"<i>~p~"..'HELLO'.."</i>", 'anither text', ":)"}
	scaleform = Initialize("MP_BIG_MESSAGE_FREEMODE", "SHOW_TERRITORY_CHANGE_MP_MESSAGE", params)

	while true do
		Citizen.Wait(0)
		DrawScaleformMovie(scaleform, 0.5, 0.5, 0.8, 0.8, 255, 255, 255, 255, 0)
	end
end)
1 Like

Heyo peoples! Im now going to start putting all of my neat discoveries onto This GitHub page, starting with mp_mission_name_freemode
which looks like:
https://images.illusivetea.me/2X36N2.png

have fun!

2 Likes

For anyone who is unsure how to discover this type of stuff :stuck_out_tongue:

Added a quick change which will allow you to do scaleform:CallHudFunction and Scaleform.RequestHud to now start using hud component scaleforms too!

Perfect ! Easy to use.

1 Like
1 Like