Jason_Gregory Posted February 10, 2010 Share Posted February 10, 2010 (edited) It would be nice adding a Event like OnDownloadStart to identify if the joined Player is allready Ingame or still Downloading Files, from the Server. When the Player joins the Server and has no cached Files, and the Progressbar appears the Event is called. OnDownloadStart/OnClientDownloadStart bool state, bool cache state - Is the Player downloading a File ? returns true is he´s downloading, false if not. progress: - How much percent of the Files are done ? An integer representing the percent of the Progressbarvalue. cache: - The Player got cached files ? An bool representing the if the Client got cached Files. true = he got a Cache, false = he dont have a Cache. time: - How much time is the Client downloading the Files ? An integer representing how much Seconds the Client is downloading the Files. optional: lefttime: - How much time left for the Client downloading the Files ? An integer representing how much time isleft. Source The source of this event is the player/Client which is downloading the File. Example: function player_downloading( state, progress, time, lefttime ) if(state == true)then if(cache)then outputChatBox(getPlayerName(source).." got Cashed Files") else outputChatBox(getPlayerName(source).." dont got cached Files") end end end addEventHandler ( "OnDownloadStart", getRootElement(), player_downloading) OnDownloadFinish/OnClientDownloadFinish bool state, int filesize, int time [, int speed] state - Is the Player downloading a File ? returns true is he downloaded any file correctly, false if not. filesize: - The size of the Files. An Integer representing the Size of the Downloaded Files in Byte. time: - How much time is the Client downloading the Files ? An integer representing how much Seconds the Client is downloading the Files. optional: speed: - How much timehe needed for downloading 1 Byte ? An integer representing how much time he needed. Returns false if no file was loaded/Timeout/Error.[/strike] Source The source of this event is the player/Client which is downloading the File. Example: function player_finished_downloading( state, filesize, time , speed) if(state)then if(filesize > 1024)then local KByte = filesize/1024 if(KByte > 1024) local MByte = filesize/1024.." MByte" if(time > 60)then local minutes = time/60.." Minutes" outputChatBox(getPlayerName(source).." downloaded "..MByte.." in"..minutes) else outputChatBox(getPlayerName(source).." downloaded "..MByte.." in"..time.." seconds") end --[[The Rest should be clear]] end end end end addEventHandler ( "OnDownloadStart", getRootElement(), player_downloading) Another Examples: - IsPlayerDownloading(the Player) - getPlayerDownloadProgress(the Player, int Progress) - getPlayerCachedElements(the Player, string Path, string Filename) Edited February 10, 2010 by Guest Link to comment
darkdreamingdan Posted February 10, 2010 Share Posted February 10, 2010 Your event doesnt really make sense. It can only be fired once, so the progress and time are unknown (0% and 0 time). Link to comment
Jason_Gregory Posted February 10, 2010 Author Share Posted February 10, 2010 Hm...then we need a another Event like OnDownloadFinish/OnClientDownloadFinish. OnDownloadStart to figure out the FileSize, the state and if he got cached Files. And OnDownloadFinish/OnClientDownloadFinish for requesting the time he needed and how much files (Downloaded Files - Cache) he finally received. First Post edited Link to comment
darkdreamingdan Posted February 11, 2010 Share Posted February 11, 2010 onClientResourceStart is fired once the download is finished and scripts are loaded. You can trigger a server event from here to reliably detect when a download is complete. Link to comment
Jason_Gregory Posted February 12, 2010 Author Share Posted February 12, 2010 Ah thats Nice Thanks for replying Link to comment
x86 Posted February 17, 2010 Share Posted February 17, 2010 Maybe this could help you: https://wiki.multitheftauto.com/wiki/IsTransferBoxActive Link to comment
Recommended Posts