mtasa-blue icon indicating copy to clipboard operation
mtasa-blue copied to clipboard

Add getPlayerDownloadStatus

Open tryangelic opened this issue 1 year ago • 1 comments

Is your feature request related to a problem? Please describe.

The function monitors and returns detailed information about the status of a player's resource (file) download on a server.

  • Tracks files: Monitors which files the player needs to download from the server
  • Measures progress: Calculates how many files have been downloaded vs. total needed
  • Monitors speed: Measures current download speed in bytes/second
  • Estimates time: Calculates remaining time based on current speed

Describe the solution you'd like

The function would return a table with the following information:

{
    -- General download status
    isDownloading = true/false,           -- Whether something is currently downloading
    totalFiles = 10,                      -- Total files to download
    downloadedFiles = 7,                  -- Files already downloaded

    -- Current progress
    currentFile = "models/vehicle.dff",   -- File currently being downloaded
    currentFileSize = 2048000,            -- Current file size (bytes)
    currentFileDownloaded = 1024000,      -- Bytes already downloaded from current file

    -- Total progress
    totalSize = 50000000,                 -- Total size of all downloads (bytes)
    totalDownloaded = 35000000,           -- Total bytes already downloaded

    -- Speed and time
    downloadSpeed = 500000,               -- Current speed (bytes/second)
    estimatedTimeRemaining = 30,          -- Estimated time remaining (seconds)

    -- File list
    fileQueue = {                         -- File queue for download
        "models/vehicle.dff",
        "textures/skin.txd",
        "sounds/engine.wav"
    },

    completedFiles = {                    -- Files already completed
        "scripts/main.lua",
        "images/logo.png"
    },

    -- Error status (if any)
    hasError = false,
    errorMessage = nil,
    failedFiles = {}
}

Describe alternatives you've considered

-- Server-side table getPlayerDownloadStatus(player thePlayer)

-- Client-side table getPlayerDownloadStatus()

Additional context

No response

Security Policy

  • [x] I have read and understood the Security Policy and this issue is not about a cheat or security vulnerability.

tryangelic avatar Jul 01 '25 18:07 tryangelic

https://wiki.multitheftauto.com/wiki/IsTransferBoxVisible https://wiki.multitheftauto.com/wiki/OnClientTransferBoxProgressChange https://wiki.multitheftauto.com/wiki/OnClientFileDownloadComplete https://wiki.multitheftauto.com/wiki/OnClientResourceFileDownload

Allerek avatar Jul 02 '25 16:07 Allerek