FatalTerror Posted January 2, 2012 Posted January 2, 2012 Hi, I've playing in a server and i see a thing, a text before the download. Exist an event for it? How he do it Thanks Paid developer. Twitter: @willia_am - http://www.williamdasilva.fr
Kenix Posted January 2, 2012 Posted January 2, 2012 Maybe you mean "Downloading Text" ? Easy,Example: Server: addEvent( "onClientSend",true ) local serverDisplay,serverText addEventHandler( "onClientSend",root, function( ) textDisplayRemoveObserver( serverDisplay, source ) end ) addEventHandler( "onPlayerJoin",root, function( ) serverDisplay = textCreateDisplay( ) textDisplayAddObserver ( serverDisplay, source ) serverText = textCreateTextItem ( "Downloading.Please wait!", 0.5, 0.5,1,255,0,0,255,2,"center","center",200 ) textDisplayAddText ( serverDisplay, serverText ) end ) Client: triggerServerEvent( "onClientSend",localPlayer ) -- trigger to remove text if player downloaded or maybe you mean this: Server: local timeShow = 5000 -- 5 seconds timerConnectShowText = { } addEventHandler( "onPlayerJoin",root, function( ) local serverDisplay = textCreateDisplay( ) textDisplayAddObserver ( serverDisplay, source ) local serverText = textCreateTextItem ( "Downloading.Please wait!", 0.5, 0.5,1,255,0,0,255,2,"center","center",200 ) textDisplayAddText ( serverDisplay, serverText ) timerConnectShowText[ source ] = setTimer( textDisplayRemoveObserver,timeShow,1,serverDisplay, source ) end ) addEventHandler( "onPlayerQuit",root, function( ) timerConnectShowText[ source ] = nil end ) Naturally, this example you need to modify it. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Al3grab Posted January 2, 2012 Posted January 2, 2012 you use this function to check if player downloading isTransferBoxActive Like this -- Client Side local localPlayer = getLocalPlayer() function checkIfDown() if isTransferBoxActive() == false then triggerServerEvent( "onClientSend",localPlayer ) -- trigger to remove text if player downloaded if isTimer(Timer) then killTimer(Timer) end -- kills the checking timer end end Timer = setTimer(checkIfDown,1000,0) ING : [xXx]~Al3grab
Kenix Posted January 2, 2012 Posted January 2, 2012 isTransferBoxActive not working if you downloading. But if you restart resource isTransferBoxActive needed or write warning with textDisplayRemoveObserver ( serverDisplay is nil ) . This is better: local timer = setTimer( function( ) if not isTransferBoxActive( ) then triggerServerEvent( "onClientSend",localPlayer ) killTimer( timer ) end end, 1000, 2 ) Remember operator "not" is if function return nil or false. This is better than to check the value. http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
Kenix Posted January 4, 2012 Posted January 4, 2012 same http://vk.com/the_kenix Вопросы задавайте на форуме, не пишите мне в личку. Please don't pm me.
myonlake Posted January 16, 2014 Posted January 16, 2014 Make a separate resource and use what Kenix posted. Make the server-side event within that downloader resource (make sure it's downloaded first), and when client calls server that a resource has been downloaded, add it to a table and wait for all resources to be in it. When everything's in, cut the text and trigger the login panel or whatever. If I helped you, please click the like button on the right Thanks!
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