Client

SD.LoadAnim

SD.LoadAnim = function(animDict)
    if type(animDict) ~= "string" then
        error("Animation dictionary identifier must be a string.")
    end

    if not HasAnimDictLoaded(animDict) then
        RequestAnimDict(animDict)

        -- Use sd.awaitLoad to wait for the animation dictionary to load with a timeout.
        SD.AwaitLoad(function()
            if HasAnimDictLoaded(animDict) then
                return true -- Return true indicating the dictionary is loaded.
            end
        end, ("Failed to load animation dictionary '%s'"):format(animDict), 5000) -- 5000 ms timeout.
    end
end

return SD.LoadAnim

Usage Example:

-- Load an animation dictionary named 'anim@heists@ornate_bank@grab_cash'.
SD.LoadAnim('anim@heists@ornate_bank@grab_cash')

This function SD.LoadAnim ensures that the specified animation dictionary is loaded into the game. It takes one parameter:

  • animDict (string): The name of the animation dictionary to be loaded.

This function is asynchronous, meaning it does not block execution of subsequent code.

Last updated