manups4e / ScaleformUI

ScaleformUI is a GTA menu styled API made with custom Scaleforms to be lighter, faster and visually better
Other
141 stars 49 forks source link

[LUA] Error on ShowFloatingHelpNotification #132

Closed hellyet closed 1 year ago

hellyet commented 1 year ago

image

  Notifications:ShowFloatingHelpNotification(
      "My test floating notification :3",
      GetEntityCoords(GetPlayerPed(-1)),
      3000
  )

Coords is correct, I don't know why it rising an error.

manups4e commented 1 year ago

Problem seems to be on Native itself 🤔

hellyet commented 1 year ago

Problem seems to be on Native itself 🤔

FXServer version is 6440 I will try to fix it, if it turns out - I will send a pull-request

manups4e commented 1 year ago

problem seems to be on SetFloatingHelpTextWorldPosition native.. Sure 😄 thanks for the contribution!

hellyet commented 1 year ago

Yeah, it is. But i don't have any idea about problem reason 😔.

manups4e commented 1 year ago

no problem 😄 we'll take a look at it as soon we'll be able to.

hellyet commented 1 year ago

Okey. I think that is cfx api problem.

hellyet commented 1 year ago

I found a way to fix it!

    Citizen.CreateThread(function()
        while true do
            Citizen.Wait(5)
            Notifications:ShowFloatingHelpNotification('Test Notification', GetEntityCoords(PlayerPedId()), -1)
        end
    end)

This function need to be called every frame.

manups4e commented 1 year ago

Yup, duration is not present in the C# counterpart. Thanks for the finding!! I'm expecting your PR!

hellyet commented 1 year ago

I'm confused... I want to split it into two functions: ShowFloatingHelpNotification, that need to be called every frame, and ShowFloatingHelpNotificationOverTime, that accept a duration param and don't need to be called every frame. What do you think?

But there is one thing: these two functions cannot be called at the same time.

manups4e commented 1 year ago

i would not add the one with duration as you have seen it seems to be erroring out.. i would default it to use -1 and remove the duration parameter.

hellyet commented 1 year ago

I fixed it! image (gif is not loading but i works correctly)

RegisterCommand("test_notif", function() 
    Notifications:ShowFloatingHelpNotification('This text will disappear in 3 seconds ', GetEntityCoords(PlayerPedId()), 3000)
end, false)
hellyet commented 1 year ago

In future I will be able to separate it into two functions, as i wrote upper.

manups4e commented 1 year ago

in this case.. use 1 function like now and use the check for the duration that

if duration == nil then duration = -1 end
hellyet commented 1 year ago

Check my PR, how i did it.

Local9 commented 1 year ago

Closed via #133