Jump to content

OnClientDownloadStart/OnDownloadStart Events


Recommended Posts

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 by Guest
Link to comment

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
  • Recently Browsing   0 members

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