undefined Posted June 26, 2015 Share Posted June 26, 2015 (edited) 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) Edited June 27, 2015 by Guest Link to comment
novo Posted June 27, 2015 Share Posted June 27, 2015 Actually, under onClientDownloadFinish you are, for some reason, using 'player' as if there was any argument expected to arrive - whilst you do not send/specify any when triggering (line 5, uniquely specifying gMe as the event's source). So I guess you instead wanted to use 'client', respective element reference to the player that triggered the event. Also note that there may be a short timespan between which the 'transferring box' is hidden and then shown up again, same span that might cause your timer to trigger the event that hides your custom messages. So basically, I would recommend you to increase your timer's interval up to 2000ms as specified in the example here. function onClientDownloadFinish() if textDisplayIsObserver(DownloadDisplay, client) then textDisplayRemoveObserver(DownloadDisplay, client) end end Link to comment
undefined Posted June 27, 2015 Author Share Posted June 27, 2015 Thank you novo. I'll try it Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now