New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[LUA] ShowFloatingHelpNotification Fix #133
Conversation
Fixed ShowFloatingHelpNotification in Notifications
|
Sorry for merge commit, it's my mistake |
|
what if duration is not specified? |
|
also.. the setTimeout with set to 3000 means it's forced to 3000.. what if i want 5000? i would use in this case we can add a check that if duration is not specified it can be set to a default of 3000 |
|
Sorry, I forgot to remove the debugging code |
---Show a floating help notification
---@param msg string @The message
---@param coords vector3 @The coordinates of the notification
---@param duration number @The display duration in milliseconds
---@return nil
function Notifications:ShowFloatingHelpNotification(msg, coords, duration)
Citizen.CreateThread(function()
local display_notification = true
Citizen.SetTimeout(duration, function() display_notification = false end)
while display_notification do
Citizen.Wait(0)
AddTextEntry("ScaleformUIFloatingHelpText", msg)
SetFloatingHelpTextWorldPosition(1, coords.x, coords.y, coords.z)
SetFloatingHelpTextStyle(1, 1, 2, -1, 3, 0)
BeginTextCommandDisplayHelp("ScaleformUIFloatingHelpText")
EndTextCommandDisplayHelp(2, false, false, -1)
end
end)
endThat is how it must to be. |
|
tbh 🤔 i would prefer a simpler function to be called per frame instead of a CreateThread inside a function.. 🤔 |
|
Now it's just a function needs to be called every frame. |
|
thanks <3 this will maintain the same code format as the other functions! |
|
Can you edit an WIKI section? Remove "duration" param and add example usage: local coords = GetEntityCoods(PlayerPedId())
local duration = 3000 -- In milliseconds
Citizen.CreateThread(function()
local display_notification = true
Citizen.SetTimeout(duration, function() display_notification = false end)
while display_notification do
Citizen.Wait(0)
Notifications:ShowFloatingHelpNotification("This message will be removed in 3 seconds", coords)
end
end) |
|
|
|
See it :) |
|
I've updated wiki. |
No description provided.