[Release] Generic DUI 2d/3d renderer

,

When client create DUI is it available for difference, i have only one PC, can’t tested right now

Yeah nah this script no longer works. The JS one and the C# one I tried to make. Something must have changed on how they do scaleforms.

Ok so only the sound plays. There is no visual at all. How do I solve that? I have tried many different things but no luck.

Aight guys, given quite a few recent “Only sound, no visual” type of replies here:

If you can’t get it working, you’re doing something wrong, double check if you’re initializing things correctly and then rendering the thing the right way and it should actually be visible to you given position in world you render the thing at. Use example JS code to verify, in screenshot above, it is literally just copy-pasted code from example :stuck_out_tongue:

Oh my god I figured out why my C# version did not work.

DrawScaleformMovie_3dNonAdditive(
sfHandle,
pos.X - 1f, pos.Y, pos.Z + 2f,
0f, 0f, 0f,
2f, 2f, 2f,
scale * 1f, scale * (9f / 16f), 1f,
2);

I forgot the f’s after the numbers which means it saw it as integers instead of floats.

Client.cs (3.3 KB)

Here is my script for the people that maybe want a C# version of it.

1 Like
local url = 'https://w.soundcloud.com/player/?url='..'https%3A//api.soundcloud.com/tracks/467725488&color=%23ff5500&auto_play=true'..'&hide_related=false&show_comments=true&show_user=true&show_reposts=false&show_teaser=true&visual=true'

local scale = 0.1

local sfName = 'generic_texture_renderer'

local width = 1280

local height = 720

local sfHandle = nil

local txdHasBeenSet = false

local duiObj = nil

function loadScaleform(scaleform)

    local scaleformHandle = RequestScaleformMovie(scaleform)

    while not HasScaleformMovieLoaded(scaleformHandle) do

        scaleformHandle = RequestScaleformMovie(scaleform)

        Citizen.Wait(0)

    end

    print("movie loded")

    return true

end

Citizen.CreateThread(function()

    while true do

        local ped = PlayerPedId()

        local pos = GetEntityCoords(ped)

        if (sfHandle ~= nil and not txdHasBeenSet) then

            print('texture set')

          PushScaleformMovieFunction(sfHandle, 'SET_TEXTURE')

     

          PushScaleformMovieMethodParameterString('meows')

          PushScaleformMovieMethodParameterString('woof')

     

          PushScaleformMovieFunctionParameterInt(0)

          PushScaleformMovieFunctionParameterInt(0)

          PushScaleformMovieFunctionParameterInt(width)

          PushScaleformMovieFunctionParameterInt(height)

     

          PopScaleformMovieFunctionVoid()

     

          txdHasBeenSet = true

        end

     

        if (sfHandle ~= nil and HasScaleformMovieLoaded(sfHandle)) then

            print(pos)

          DrawScaleformMovie_3dNonAdditive(sfHandle, pos.x, pos.y, pos.z+1, 0, 0, 0, 2, 2, 2, scale * 1, scale * (9/16), 1, 2)

        end

        Citizen.Wait(0)

    end

end)

AddEventHandler('onResourceStart', function(resourceName)

    if (resourceName == GetCurrentResourceName()) then

        sfHandle = loadScaleform(sfName)

   

        runtimeTxd = 'meows'

   

        local txd = CreateRuntimeTxd('meows')

        local duiObj = CreateDui(url, width, height)

        local dui = GetDuiHandle(duiObj)

        local tx = CreateRuntimeTextureFromDuiHandle(txd, 'woof', dui)

    end

end)

AddEventHandler('onResourceStop', function(name)

    if name == GetCurrentResourceName() then

        DestroyDui(duiObj)

        SetScaleformMovieAsNoLongerNeeded(sfName)

    end

end)

can someone validate my lua version of it, no clue why it wont work.

2 Likes

Did you get this working? I’d love to help test it out tomorrow.

so you can try this, just add it to your server.cfg and then you can do /testdui. i did notice that in the lua version vs the JS version, the lua version has blurred edges while the js has crisp edges. but this should work as a lua solution
projector.zip (5.6 KB)

1 Like

Thanks - that seems to be stuck to my player character :slight_smile:

doing /testdui twice I can hear the audio but the video doesnt play.

yeah just an example of how it could be used. will have to work it from there

1 Like

is there a way to get a cleaner looking output like full HD , WQHD or 4k ?

I want your giant screen. Can you tell me the