Jump to content

Player download question


BennyBunny

Recommended Posts

you can trigger server event onClientResourceStart

e.g.

server:

playersReady = {} 
addEvent('onPlayerFinishedDownloading',true) 
addEventHandler('onPlayerFinishedDownloading',getRootElement(),function() 
     playersReady[source] = true 
end) 
  
addEventHandler('onPlayerQuit',getRootElement(),function() 
     playersReady[source] = nil 
end) 

client:

addEventHandler('onClientResourceStart',getResourceRootElement(getThisResource()),function() 
     triggerServerEvent('onPlayerFinishedDownloading',getLocalPlayer()) 
end) 

and check if playersReady[player] returns true, if it does then hes not downloading

Link to comment

I don't think that will work correctly Buffalo, if one (small) resource is ready with downloading, it will send the onPlayerFinishedDownloading event before the other resources are downloaded.

This function returns if the downloading box is active, so you can use it to detect if the player is still downloading.

isTransferBoxActive 

Link to comment
It's important to note that resources aren't started on the client until they're completely downloaded, so a resource cannot use this function to detect if it's own files are downloaded. A client-side resource triggers the onClientResourceStart event when the files it requires are downloaded

So that client function wont fit here. I think all client resources are started at the same time, independently which downloaded first.

Link to comment

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...