BennyBunny Posted September 3, 2011 Share Posted September 3, 2011 How can i find out when a player comes in my server he is dowloading? So that my login kick not kick him when he is still dowloading? Link to comment
Buffalo Posted September 3, 2011 Share Posted September 3, 2011 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
SDK Posted September 3, 2011 Share Posted September 3, 2011 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
Buffalo Posted September 3, 2011 Share Posted September 3, 2011 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
SDK Posted September 3, 2011 Share Posted September 3, 2011 I didn't understand him correctly, I thought he meant until all resources are downloaded/started. onClientResourceStart is the way then ofc, use it instead of onPlayerJoin. Link to comment
BennyBunny Posted September 4, 2011 Author Share Posted September 4, 2011 THX for the help i use isTransferBoxActive perfect for my login script 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