I'm use these code for create text while resource downloading. But sometime text not remove. What is the problem?
Client
local gMe = getLocalPlayer()
downloadTimer = setTimer(function()
if not isTransferBoxActive() then
if not getElementData(gMe, "loggedin") then
triggerServerEvent("onClientDownloadFinish", gMe)
outputChatBox("test") -- It is showing.
fadeCamera(true)
showChat(false)
showPlayerHudComponent("radar",false)
end
if isTimer(downloadTimer) then killTimer(downloadTimer) end
end
end, 50, 0)
Server
local DownloadDisplay, textItem
addEventHandler("onResourceStart", root, function()
DownloadDisplay = textCreateDisplay()
textItem = textCreateTextItem ("Kaynak indiriliyor...\n(Resource is downloading)\n\nTundra Gaming\nv1.0.0", 0.5, 0.4, "high", 255, 255, 255, 255, 2.5, "center", "center", 0)
textDisplayAddText(DownloadDisplay, textItem)
end)
addEventHandler("onPlayerJoin", root, function()
textDisplayAddObserver(DownloadDisplay, source)
end)
addEvent("onClientDownloadFinish", true)
addEventHandler("onClientDownloadFinish", root, function()
if textDisplayIsObserver(DownloadDisplay, source) then
textDisplayRemoveObserver(DownloadDisplay, source)
end
end)