Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local started=false
- addEventHandler ( "onTransferBoxStateChange", localPlayer,function(current,total)
- cancelEvent() -- disable current transfer box
- if(not previous or previous~=current)then
- if(not started and current~=total)then
- onStartDownload()
- started=true
- end
- if(finish~=total)then
- onDownload(current,total)
- if(current==total)then
- onFinishDownloading(current,total)
- started=false
- finish=total
- end
- end
- end
- local previous=current
- end)
- function onStartDownload(current,total)
- outputChatBox("START DOWNLOADING")
- end
- function onDownload(current,total)
- outputChatBox(inspect{"Downloading: ",current,"/",total})
- end
- function onFinishDownloading(current,total)
- outputChatBox("FINISH DOWNLOADING")
- end
- --[[
- example output with script contain 15 files, size of this files: 8 921 880 B ( by windows ):
- START DOWNLOADING
- { "Downloading: ", 0, "/", 8921880 }
- { "Downloading: ", 446094, "/", 8921880 }
- { "Downloading: ", 669141, "/", 8921880 }
- { "Downloading: ", 1338282, "/", 8921880 }
- { "Downloading: ", 1784376, "/", 8921880 }
- { "Downloading: ", 3568752, "/", 8921880 }
- { "Downloading: ", 8921880, "/", 8921880 }
- FINISH DOWNLOADING
- ]]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement