This is a SourceMod extension that allows file transfers to players that are already in the game.
Just as any other AMBuild project:
- Install AMBuild
- Download Half-Life 2 SDK, Metamod:Source and SourceMod
mkdir build && cd build
python ../configure.py --hl2sdk-root=??? --mms-path=??? --sm-path=??? --sdks=csgo
ambuild
Simply copy the extension binary to the extensions
folder and the include file into the scripting/include
folder.
Now just create a new plugin and include latedl.inc
.
#pragma semicolon 1
#pragma newdecls required
#include <sourcemod>
#include <latedl>
public Plugin myinfo =
{
name = "My First Plugin",
author = "Me",
description = "My first plugin ever",
version = "1.0",
url = "http://www.sourcemod.net/"
};
public void OnPluginStart()
{
RegAdminCmd("testdl", Command_TestDL, ADMFLAG_SLAY);
}
public void OnDownloadSuccess(int iClient, char[] filename) {
if (iClient > 0)
return;
PrintToServer("All players successfully downloaded file '%s'!", filename);
}
public Action Command_TestDL(int client, int args)
{
//create arbitrary file
int time = GetTime();
char tstr[64];
FormatEx(tstr, 64, "%d.txt", time);
File file = OpenFile(tstr, "wt", true, NULL_STRING);
WriteFileString(file, tstr, false);
CloseHandle(file);
//send
AddLateDownload(tstr);
return Plugin_Handled;
}
The extension exposes following cvars:
latedl_minimalbandwidth
(default = 64) - Kick clients with lower bandwidth (in kbps). Zero to disable.latedl_maximaldelay
(default = 500) - Acceptable additional delay (in ms) when sending files.latedl_requireupload
(default = 1) - Kick clients with "sv_allowupload" = 0. Zero to disable.
The first two cvars limit the maximal time that the download can take. The maximal duration (in seconds) is computed using following formula: maximalDelay / 1000 + (fileSizeInBytes * 8) / (minimalBandwidth * 1000)
If the player fails to download the file in time, he's kicked.
The last cvar kicks any player that rejects incoming files.
- This was tested only in CS:GO, but any modern Source game (OrangeBox+) should be ok.
- This extension used to be a part of the Gorme project.
-
-
- 2018 Valve torpedoed this extension by defaulting sv_allowupload to zero.
-