[HELP] Problem with notification


#1

Hi,

I used a notification function, but I’ve a problem.

When I call the fuction (inside DisplayOnscreenKeyboard() ), the notification appear 1 - 10 seconde after (it’s variable), and sometimes it doesn’t appear.

Does anyome have a solution or an explication please ?

My notif function:

function sendnotif(message)
SetNotificationTextEntry("STRING")
AddTextComponentString(message)
DrawNotification(false, false)
	
end

Classic.

And my code:

function retirerargent()
	inputretirer = true
		DisplayOnscreenKeyboard(false, "FMMC_KEY_TIP8", "", "", "", "", "", 64)
		
		while (inputretirer) do
		Wait(1)		
		if UpdateOnscreenKeyboard() == 3 then
		inputretirer = false
		
		elseif UpdateOnscreenKeyboard() == 1 then
		local RetirerInput = GetOnscreenKeyboardResult()
		if string.len(RetirerInput) > 0 then
		argentretirer = tonumber(RetirerInput)
		TriggerServerEvent("bkargent", argentretirer)
		inputretirer = false			
		else
		DisplayOnscreenKeyboard(false, "FMMC_KEY_TIP8", "", "", "", "", "", 64)
		end
		elseif UpdateOnscreenKeyboard() == 2 then
		inputretirer = false
		end
		
end
end

My serverEvent is triggering this clientEvent:

RegisterNetEvent('notify')
AddEventHandler('notify', function(msg)
	sendnotif(msg)
end)

For every sendnotif I call, same inside the function retirerargent(), the time when notif appearrr is variable…