Hello, I’m releasing a Scaleform wrapper that is much easier to read and understand. Here is an example of a brief scaleform script using this wrapper.
Citizen.CreateThread(function()
scaleform = GetScaleform("binoculars")
i = 0
while true do
Wait(0)
i = i + 1
RenderFullscreen(scaleform)
if i == 2000 then -- turns off after 20ish seconds
UnloadScaleform(scaleform)
end
end
end)
Here’s another snippet of a helicopter hud with changing params.
Citizen.CreateThread(function()
scaleform = GetScaleform("heli_cam")
i = 0
while true do
Wait(0)
i = i + 1
RenderFullscreen(scaleform)
if i > 500 then -- Just random example of changing the thingy.
x = math.random(10,100)
CallFunction(scaleform, "SET_ALT_FOV_HEADING", 152.0 + x, 0.7, 90.0 + x)
end
if i == 3500 then -- turns off after 30ish seconds
UnloadScaleform(scaleform)
end
end
end)
Here’s the download: scale.zip (1.7 KB)
The example script will create the binoculars effect for roughly 20 seconds (depending on framerate) and then it will turn the effect off by unloading the scaleform. The second example creates a helicopter hud and applies random values to it.
Credits / References used:
- https://github.com/citizenfx/fivem/blob/master/code/client/clrcore/External/Scaleform.cs#L90
- https://runtime.fivem.net/doc/reference.html#_0x11FE353CF9733E6F
- @mraes for throwing me some explanations and a bunch of help.
- @phosphorus on discord for helping with the float checking.
I hope you enjoy.