Jump to content

Before download


FatalTerror

Recommended Posts

Posted

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.

Posted

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

Posted

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.

  • 2 years later...
Posted

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!

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...