New FiveM version has messed up scaleforms

Every single scaleform that I use on my server worked perfectly in the last stable version, but they all messed up with the new version.
I tested this new version before it cames out (when it was the canary version) and indeed, the scaleforms didn’t work as well.

The last canary version (this new stable version) was tasted in the same server by random people beside other people that had the last stable version, and every single canary client failed when attempting to load the next scaleform.

Client version: ““stable”” b2372
Server version: FXServer-master SERVER v1.0.0.4394 win32

Citizen.CreateThread(function()
        StartScreenEffect("MP_Celeb_Preload_Fade", 0, true)
        local draw = true

        local sf = scaleform.Get("mp_celebration")
    	while not scaleform.IsLoaded(sf) do Citizen.Wait(0) end

    	local sf_bg = scaleform.Get("mp_celebration_bg")
    	while not scaleform.IsLoaded(sf_bg) do Citizen.Wait(0) end

    	local sf_fg = scaleform.Get("mp_celebration_fg")
    	while not scaleform.IsLoaded(sf_fg) do Citizen.Wait(0) end

    	Citizen.CreateThread(function()
    		while draw do
    			Citizen.Wait(0)
                DrawScaleformMovieFullscreenMasked(sf_bg, sf_fg, 255, 255, 255, 255)
                DrawScaleformMovieFullscreen(sf, 255, 255, 255, 255)
    		end
    	end)

        local function ExecuteOnEndingWalls(func,...)
            scaleform.Call(sf,      func,"ending",...)
            scaleform.Call(sf_fg,   func,"ending",...)
            scaleform.Call(sf_bg,   func,"ending",...)
        end

        scaleform.Call(sf, "CREATE_STAT_WALL", "ending", "HUD_COLOUR_BLUE")
        scaleform.Call(sf_fg, "CREATE_STAT_WALL", "ending", "HUD_COLOUR_RED")
        scaleform.Call(sf_bg, "CREATE_STAT_WALL", "ending", "HUD_COLOUR_BLACK")
        if place then
            ExecuteOnEndingWalls("ADD_POSITION_TO_WALL", 1)
            ExecuteOnEndingWalls("ADD_TIME_TO_WALL", 1, "CELEB_TIME")
            ExecuteOnEndingWalls("ADD_WINNER_TO_WALL", 1, "Antalme", "", 0, false, "", false)
        else
            ExecuteOnEndingWalls("ADD_POSITION_TO_WALL", "dnf")
            ExecuteOnEndingWalls("ADD_TIME_TO_WALL", 1, "CELEB_TIME")
            ExecuteOnEndingWalls("ADD_WINNER_TO_WALL", "CELEB_LOSER", "Antalme", "", 0, false, "", false)
        end
        ExecuteOnEndingWalls("ADD_BACKGROUND_TO_WALL", 70, 4)

        PushScaleformMovieFunction(sf, "GET_TOTAL_WALL_DURATION")
        local ret = EndScaleformMovieMethodReturn()
		
        print("before")
        while not GetScaleformMovieFunctionReturnBool(ret) do Citizen.Wait(0) end
        print("after")

        local totalWallTime = GetScaleformMovieFunctionReturnInt(ret)

        ExecuteOnEndingWalls("SHOW_STAT_WALL")

        Citizen.Wait(totalWallTime+700)

        draw = false
        SetScaleformMovieAsNoLongerNeeded(sf)
        SetScaleformMovieAsNoLongerNeeded(sf_bg)
        SetScaleformMovieAsNoLongerNeeded(sf_fg)
        StartScreenEffect((1 and (1 == 1 and "MP_Celeb_Win_Out" or "MP_Celeb_Lose_Out") or "MP_Celeb_Lose_Out"), 0, false)
    end)
end)

What should happen: When executed the code from above, the race finish scaleform should appear, with a big one, and the cash you got, etc.
What happen: You got nothing more than a screen flash.

The problem?: The problem is exactly at while not GetScaleformMovieFunctionReturnBool(ret) do Citizen.Wait(0) end, the loop never breaks because GetScaleformMovieFunctionReturnBool() is the function that has stopped working properly. So you will get the “before” output in your console but never the “after” output.

for a start, you should be using IsScaleformMovieMethodReturnValueReady, not GetScaleformMovieFunctionReturnBool, like what i use here:

BeginScaleformMovieMethod(scaleforms.main.handle, "GET_TOTAL_WALL_DURATION")
    local retHandle = EndScaleformMovieMethodReturnValue()

    if retHandle ~= 0 then 
        while not IsScaleformMovieMethodReturnValueReady(retHandle) do Wait(0) end
        local time = GetScaleformMovieFunctionReturnInt(retHandle)
        endTime = startTime + time
    end

or so

2 Likes

IsScaleformMovieMethodReturnValueReady works correctly, thank you very much for the info.

Anyways, the function GetScaleformMovieFunctionReturnBool() stopped working properly in this new version and I guess it should be fixed.

I highly doubt that, moreso the fact said function doesnt even return a bool and only the totalDurationMs, so i presume that how you was using it ended up being some weird way it ended up working

Nope was intended as you can see here
https://github.com/citizenfx/natives/compare/6d283ae73243…5abe39552c75

It seems it had an incorrect alias for that native, so GetScaleformMovieFunctionReturnBool() was never intended to be used for that native

Just wondering - why did you not report it at that time?

1 Like

How can i install this?

…what?