open.mp | RedirectDownload
  • Home
  • FAQ
  • Forum
  • Servers
  • Docs
  • Blog
  • Login
  • Englishاللغة العربيةar-TNবাংলাbosanski jezikDeutschΕλληνικάEspañoleestiفارسیFrançaisHrvatskimagyarBahasa IndonesiaItaliano日本語ქართულიlietuvių kalbaNederlandsNorskjęzyk polskiPortuguêsRomânăРусскийslovenski jezikсрпски језикไทยWikang TagalogTürkçeУкраїнськаاردوTiếng Việt简体中文繁體中文
warning Not Translated

This page has not been translated into the language that your browser requested. The English content is being shown as a fallback.

If you want to contribute a translation for this page then please click here.

RedirectDownload

note

This function was added in SA-MP 0.3.DL R1 and will not work in earlier versions!

Description

Redirect a player custom AddCharModel or AddSimpleModel download to a specific HTTP webpage.

Parameters

NameDescription
playeridThe ID of the player that requested custom models download.
url[]The URL to redirect download

Return Values

  • 1: The function executed successfully.
  • 0: The function failed to execute.

Example Usage from dl_redirect filterscript

new baseurl[] = "https://files.sa-mp.com/server";

public OnPlayerRequestDownload(playerid, type, crc)
{
    if (!IsPlayerConnected(playerid))
    {
        return 0;
    }

    new
        fullURL[256],
        fileName[64],
        foundFileName = 0;

    if (type == DOWNLOAD_REQUEST_TEXTURE_FILE)
    {
        foundFileName = FindTextureFileNameFromCRC(crc, fileName, sizeof fileName);
    }
    else if (type == DOWNLOAD_REQUEST_MODEL_FILE)
    {
        foundFileName = FindModelFileNameFromCRC(crc, fileName, sizeof fileName);
    }

    if (foundFileName)
    {
        format(fullURL, sizeof fullURL, "%s/%s", baseurl, fileName);
        RedirectDownload(playerid, fullURL);
    }

    return 0;
}

Related Functions

  • AddCharModel: Adds a new custom character model for download.
  • AddSimpleModel: Adds a new custom simple object model for download.
  • AddSimpleModelTimed: Adds a new custom simple object model for download.
  • OnPlayerFinishedDownloading: Called when a player finishes downloading custom models.

Community

  • Discord
  • Instagram
  • Twitter
  • Twitch
  • YouTube
  • Facebook
  • VK

More

  • SA-MP
  • Blog
  • GitHub