AlliedModders

AlliedModders (https://forums.alliedmods.net/index.php)
-   Extensions (https://forums.alliedmods.net/forumdisplay.php?f=134)
-   -   [EXTENSION] Late Downloads (https://forums.alliedmods.net/showthread.php?t=305153)

Backup 02-09-2018 14:24

[EXTENSION] Late Downloads
 
Late Downloads


What is this?
This is a SourceMod extension that allows file transfers to players that are already in the game.


How to build this?
Just as any other AMBuild project:
  1. Install AMBuild
  2. Download Half-Life 2 SDK, Metamod:Source and SourceMod
  3. Code:

    mkdir build && cd build
  4. Code:

    python ../configure.py --hl2sdk-root=??? --mms-path=??? --sm-path=??? --sdks=csgo
  5. Code:

    ambuild


How to use this?
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.
Sample script
PHP Code:

#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_TestDLADMFLAG_SLAY);
}

public 
void OnDownloadSuccess(int iClientchar[] filename) {
    if (
iClient 0)
        return;
    
PrintToServer("All players successfully downloaded file '%s'!"filename);
}

public 
Action Command_TestDL(int clientint args)
{
    
//create arbitrary file
    
int time GetTime();
    
char tstr[64];
    
FormatEx(tstr64"%d.txt"time);
    
File file OpenFile(tstr"wt"trueNULL_STRING);
    
WriteFileString(filetstrfalse);
    
CloseHandle(file);
    
    
//send
    
AddLateDownload(tstr);
    return 
Plugin_Handled;


Extension configuration
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.
Additional information
  • 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.
  • YESTERDAY Valve changed the default settings for sv_allowupload (now disabled by default), torpedoing this extension. :cry:


Sources and binaries
Latest sources are availabe at github:
https://github.com/jonatan1024/latedl
Binaries for windows and linux should be availabe at the github releases page:
https://github.com/jonatan1024/latedl/releases

ALiV 02-12-2018 07:00

Re: [EXTENSION] Late Downloads
 
this plugin will work for download zip or rar archive?

CrazyHackGUT 02-12-2018 13:36

Re: [EXTENSION] Late Downloads
 
Nope. Source don't supports zip archives.

GHartmann 02-12-2018 13:50

Re: [EXTENSION] Late Downloads
 
This is pretty neat, wasn't aware it was possible!

I built it against TF2 with a few small changes:

Code:

179c179
<                      resendSuccess = chan->SendFile(activeDownload.filename, g_TransferID++);
---
>                      resendSuccess = chan->SendFile(activeDownload.filename, g_TransferID++, false);
301c301
<                      if (chan->SendFile(filename, g_TransferID)) {
---
>                      if (chan->SendFile(filename, g_TransferID, false)) {
334c334
<                              g_ActiveDownloads.Remove(g_ActiveDownloads.Count() - 1);
---
>                              g_ActiveDownloads.RemoveMultipleFromTail(1);
413c413
< }
---
> }
\ No newline at end of file

And tested it in-game, downloaded the text file.
Seems like this would be very useful for downloading non-essential files.

Edit: Actually, it seems it adds the files to the download list for new clients connecting, which means anyone connecting after a late download is added will still have to sit through the downloading of files. Wonder if there's a way around that?

ALiV 02-12-2018 14:35

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by CrazyHackGUT (Post 2577844)
Nope. Source don't supports zip archives.

what plugin can download zip archive?

Papero 02-13-2018 16:21

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by ALiV (Post 2577848)
what plugin can download zip archive?

No-one, (it isn't supported by the source(engine)...)

Backup 02-14-2018 17:34

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by GHartmann (Post 2577846)
I built it against TF2 with a few small changes
...

Thanks, I've added these changes into the source!

Quote:

Originally Posted by GHartmann (Post 2577846)
Actually, it seems it adds the files to the download list for new clients connecting, which means anyone connecting after a late download is added will still have to sit through the downloading of files. Wonder if there's a way around that?

Yep, during the "latedl call", the file is also added into the download table (see function AddStaticDownloads). The reasoning behind this behaviour is simple - some player might connect while everybody else is getting the ingame download.
I might add a boolean parameter for cases when you don't need file consistency amongst the players and one more native for file removal from the download table. I'm curious - what exactly is your use case? How the fact that some players doesn't have the needed files doesn't break their experience?

GHartmann 02-14-2018 18:11

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by Backup (Post 2578228)
what exactly is your use case?

My thought was, you could have certain files that aren't required download in the background so new players joining the server won't have to sit through all those files being downloaded.

For example as a donor perk on a server I play on, each player has a texture that floats above their head at the end of the round. These sorts of files would be fine to load as needed in the background since they aren't essential for players to have.

Backup 02-15-2018 15:22

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by GHartmann (Post 2578232)
My thought was, you could have certain files that aren't required download in the background so new players joining the server won't have to sit through all those files being downloaded.

For example as a donor perk on a server I play on, each player has a texture that floats above their head at the end of the round. These sorts of files would be fine to load as needed in the background since they aren't essential for players to have.

I've added parameters that can enable this behavior (set addAsStatic to false).

I'm not sure what the players that won't download the texture will see, my guess is pink-black checkerboard and console full of errors. :D Some network entity filtering should solve this quite easily tho.

GHartmann 02-16-2018 04:40

Re: [EXTENSION] Late Downloads
 
Change for latest version to build against TF2:

Code:

257,259c257
<      for ( int i = 0; i < g_BatchDeadlines.Count(); i++ ) {
<              g_BatchDeadlines[i] = 0;
<      }
---
>      g_BatchDeadlines.FillWithValue(0);

Which is just the same code provided by that function.

Or like this, but I dunno if there's a cleaner way to do this without inheriting:
Code:

template< class T, class A = CUtlMemory<T> >
class CUtlVectorExt : public CUtlVector<T, A>
{
public:
        void FillWithValue( const T& src );
};

template< typename T, class A >
void CUtlVectorExt<T, A>::FillWithValue( const T& src )
{
        for ( int i = 0; i < this->Count(); i++ )
        {
                this->Element(i) = src;
        }
}


Backup 02-16-2018 15:05

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by GHartmann (Post 2578447)
Change for latest version to build against TF2:
Code:

257,259c257
<      for ( int i = 0; i < g_BatchDeadlines.Count(); i++ ) {
<              g_BatchDeadlines[i] = 0;
<      }
---
>      g_BatchDeadlines.FillWithValue(0);

...

I've replaced it using the definition for SetCount:
https://github.com/jonatan1024/lated...1596de03d0f808

GHartmann 02-24-2018 16:28

Re: [EXTENSION] Late Downloads
 
I've discovered some sort of memory(?) bug, but I'm not proficient enough with C++ to figure out the cause.

Apologies in advance if there's actually just something wrong on my end I'm not seeing.

The test code:
Code:

#pragma semicolon 1
#pragma newdecls required

#include <sourcemod>
#include <tf2_stocks>
#include <latedl>

public Plugin myinfo =
{
        name = "Late Downloads Test",
        author = "Hartmann",
        description = "Late downloads testing",
        version = "1.3.2",
        url = "http://www.sourcemod.net/"
};

public void OnPluginStart()
{
        RegAdminCmd("testdl", Command_TestDL, ADMFLAG_SLAY);
        RegAdminCmd("testdl2", Command_TestDL2, ADMFLAG_SLAY);
        RegAdminCmd("testdl2b", Command_TestDL2b, ADMFLAG_SLAY);
        RegAdminCmd("testdl3", Command_TestDL3, ADMFLAG_SLAY);
        RegAdminCmd("testdl4", Command_TestDL4, ADMFLAG_SLAY);
}

public void OnDownloadSuccess(int iClient, char[] filename) {
        PrintToServer("%N downloaded file %s", iClient, filename);
}

public Action Command_TestDL(int client, int args)
{
        if (args > 0)
        {
                char full[128];
                char arg[128];
               
                GetCmdArgString(full, sizeof(full));
                GetCmdArg(1, arg, sizeof(arg));
               
                AddLateDownload(arg, false);
        }

        return Plugin_Handled;
}

public Action Command_TestDL2(int client, int args)
{
        char files[8][128];
       
        files[0] = "test/random_128K_00.bin";
        files[1] = "test/random_128K_01.bin";
        files[2] = "test/random_128K_02.bin";
        files[3] = "test/random_128K_03.bin";
        files[4] = "test/random_128K_04.bin";
        files[5] = "test/random_128K_05.bin";
        files[6] = "test/random_128K_06.bin";
        files[7] = "test/random_128K_07.bin";
       
        AddLateDownloads(files, 8, false);
       
        return Plugin_Handled;
}

public Action Command_TestDL2b(int client, int args)
{
        char files[8][24];
       
        files[0] = "test/random_128K_00.bin";
        files[1] = "test/random_128K_01.bin";
        files[2] = "test/random_128K_02.bin";
        files[3] = "test/random_128K_03.bin";
        files[4] = "test/random_128K_04.bin";
        files[5] = "test/random_128K_05.bin";
        files[6] = "test/random_128K_06.bin";
        files[7] = "test/random_128K_07.bin";
       
        AddLateDownloads(files, 8, false);
       
        return Plugin_Handled;
}

public Action Command_TestDL3(int client, int args)
{
        AddLateDownload("test/random_128K_00.bin", false);
        AddLateDownload("test/random_128K_01.bin", false);
        AddLateDownload("test/random_128K_02.bin", false);
        AddLateDownload("test/random_128K_03.bin", false);
        AddLateDownload("test/random_128K_04.bin", false);
        AddLateDownload("test/random_128K_05.bin", false);
        AddLateDownload("test/random_128K_06.bin", false);
        AddLateDownload("test/random_128K_07.bin", false);

        return Plugin_Handled;
}

public Action Command_TestDL4(int client, int args)
{
        char[] file00 = "test/random_128K_00.bin";
        char[] file01 = "test/random_128K_01.bin";
        char[] file02 = "test/random_128K_02.bin";
        char[] file03 = "test/random_128K_03.bin";
        char[] file04 = "test/random_128K_04.bin";
        char[] file05 = "test/random_128K_05.bin";
        char[] file06 = "test/random_128K_06.bin";
        char[] file07 = "test/random_128K_07.bin";
       
        AddLateDownload(file00, false);
        AddLateDownload(file01, false);
        AddLateDownload(file02, false);
        AddLateDownload(file03, false);
        AddLateDownload(file04, false);
        AddLateDownload(file05, false);
        AddLateDownload(file06, false);
        AddLateDownload(file07, false);
       
        return Plugin_Handled;
}

Running testdl fails to call the forward with the correct data. The files are all uploaded to the client, but the success forward isn't called until the last file is uploaded, and with the incorrect file name.
Code:

testdl test/random_128K_00.bin
testdl test/random_128K_01.bin
testdl test/random_128K_02.bin
testdl test/random_128K_03.bin
testdl test/random_128K_04.bin
testdl test/random_128K_05.bin
testdl test/random_128K_06.bin
testdl test/random_128K_07.bin
Gestalt💙Hartmann downloaded file test/random_128K_07.bin
Console downloaded file test/random_128K_07.bin
Gestalt💙Hartmann downloaded file test/random_128K_07.bin
Console downloaded file test/random_128K_07.bin
Gestalt💙Hartmann downloaded file test/random_128K_07.bin
Console downloaded file test/random_128K_07.bin
Gestalt💙Hartmann downloaded file test/random_128K_07.bin
Console downloaded file test/random_128K_07.bin
Gestalt💙Hartmann downloaded file test/random_128K_07.bin
Console downloaded file test/random_128K_07.bin
Gestalt💙Hartmann downloaded file test/random_128K_07.bin
Console downloaded file test/random_128K_07.bin
Gestalt💙Hartmann downloaded file test/random_128K_07.bin
Console downloaded file test/random_128K_07.bin
Gestalt💙Hartmann downloaded file test/random_128K_07.bin
Console downloaded file test/random_128K_07.bin

Running testdl2 and testdl3 works as expected:
Code:

testdl2
Gestalt💙Hartmann downloaded file test/random_128K_00.bin
Console downloaded file test/random_128K_00.bin
Gestalt💙Hartmann downloaded file test/random_128K_01.bin
Console downloaded file test/random_128K_01.bin
Gestalt💙Hartmann downloaded file test/random_128K_02.bin
Console downloaded file test/random_128K_02.bin
Gestalt💙Hartmann downloaded file test/random_128K_03.bin
Console downloaded file test/random_128K_03.bin
Gestalt💙Hartmann downloaded file test/random_128K_04.bin
Console downloaded file test/random_128K_04.bin
Gestalt💙Hartmann downloaded file test/random_128K_05.bin
Console downloaded file test/random_128K_05.bin
Gestalt💙Hartmann downloaded file test/random_128K_06.bin
Console downloaded file test/random_128K_06.bin
Gestalt💙Hartmann downloaded file test/random_128K_07.bin
Console downloaded file test/random_128K_07.bin

Code:

testdl3
Gestalt💙Hartmann downloaded file test/random_128K_00.bin
Console downloaded file test/random_128K_00.bin
Gestalt💙Hartmann downloaded file test/random_128K_01.bin
Console downloaded file test/random_128K_01.bin
Gestalt💙Hartmann downloaded file test/random_128K_02.bin
Console downloaded file test/random_128K_02.bin
Gestalt💙Hartmann downloaded file test/random_128K_03.bin
Console downloaded file test/random_128K_03.bin
Gestalt💙Hartmann downloaded file test/random_128K_04.bin
Console downloaded file test/random_128K_04.bin
Gestalt💙Hartmann downloaded file test/random_128K_05.bin
Console downloaded file test/random_128K_05.bin
Gestalt💙Hartmann downloaded file test/random_128K_06.bin
Console downloaded file test/random_128K_06.bin
Gestalt💙Hartmann downloaded file test/random_128K_07.bin
Console downloaded file test/random_128K_07.bin

testdl2b works-ish. It reports a failure for "test/ran", and drops off the last file due to it.
Code:

testdl2b
Gestalt💙Hartmann downloaded file test/random_128K_00.bin
Console downloaded file test/random_128K_00.bin
L 02/24/2018 - 16:22:44: [LATEDL] Failed to track progress of sending file 'test/ran' to client 1 ('192.168.1.20:27005', 192.168.1.20:27005)!
L 02/24/2018 - 16:22:44: [LATEDL] Client 1 failed to download file 'test/ran'!
Console downloaded file test/ran
Gestalt💙Hartmann downloaded file test/random_128K_01.bin
Console downloaded file test/random_128K_01.bin
Gestalt💙Hartmann downloaded file test/random_128K_02.bin
Console downloaded file test/random_128K_02.bin
Gestalt💙Hartmann downloaded file test/random_128K_03.bin
Console downloaded file test/random_128K_03.bin
Gestalt💙Hartmann downloaded file test/random_128K_04.bin
Console downloaded file test/random_128K_04.bin
Gestalt💙Hartmann downloaded file test/random_128K_05.bin
Console downloaded file test/random_128K_05.bin
Gestalt💙Hartmann downloaded file test/random_128K_06.bin
Console downloaded file test/random_128K_06.bin

Running testdl4 fails like this:
Code:

testdl4
Gestalt💙Hartmann downloaded file
Console downloaded file
Gestalt💙Hartmann downloaded file test/random_128K_00.bin
Console downloaded file test/random_128K_00.bin
L 02/24/2018 - 16:11:44: [LATEDL] Failed to track progress of sending file 'bin' to client 1 ('192.168.1.20:27005', 192.168.1.20:27005)!
L 02/24/2018 - 16:11:44: [LATEDL] Client 1 failed to download file 'bin'!
Console downloaded file bin
Gestalt💙Hartmann downloaded file test/random_128K_00.bin
Console downloaded file test/random_128K_00.bin
Gestalt💙Hartmann downloaded file test/random_128K_00.bin
Console downloaded file test/random_128K_00.bin
Gestalt💙Hartmann downloaded file test/random_128K_00.bin
Console downloaded file test/random_128K_00.bin
Gestalt💙Hartmann downloaded file test/random_128K_00.bin
Console downloaded file test/random_128K_00.bin
Gestalt💙Hartmann downloaded file test/random_128K_00.bin
Console downloaded file test/random_128K_00.bin


Leonardo 02-25-2018 04:18

Re: [EXTENSION] Late Downloads
 
Compiled with MSVC v14.0 against sdk2013 on windows x64, AddLateDownloads with addAsStatic=true always returns 0. This happens when filled addedFiles is passed to SendFiles function via pointer.
Before sending to SendFiles, FOR_EACH_VEC says it's filled, but within SendFiles FOR_EACH_VEC says it's empty.

Backup 02-25-2018 09:31

Re: [EXTENSION] Late Downloads
 
1 Attachment(s)
Quote:

Originally Posted by GHartmann (Post 2579959)
I've discovered some sort of memory(?) bug, but I'm not proficient enough with C++ to figure out the cause.

Apologies in advance if there's actually just something wrong on my end I'm not seeing.

...

Thanks for the error reports! All problems were on my side, except for the testdl4.
testdl & testdl2b problems were indeed caused by bad memory handling, storing pointers to plugin's stack. I've fixed these in the new release, you can try it out.
testdl4 is a bug in sourcepawn itself, you can try it out just by replacing AddLateDownload by PrintToServer. It is some kind of compiler issue, probably solved by now:
https://github.com/alliedmodders/sou...014969e47f9396
You can work around this issue by moving the brackets behind the variable name. If you look at the attached image, you can clearly see the problem.

Quote:

Originally Posted by Leonardo (Post 2580025)
Compiled with MSVC v14.0 against sdk2013 on windows x64, AddLateDownloads with addAsStatic=true always returns 0. This happens when filled addedFiles is passed to SendFiles function via pointer.
Before sending to SendFiles, FOR_EACH_VEC says it's filled, but within SendFiles FOR_EACH_VEC says it's empty.

Oops, fixed, try it now please. :)

GHartmann 02-25-2018 12:23

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by Backup (Post 2580083)
You can work around this issue by moving the brackets behind the variable name. If you look at the attached image, you can clearly see the problem.

I was trying to figure out what the problem could be for the longest time, I assumed my code was bugged somehow. Ah well, thanks for the fix!

Another bug:
latedl_minimalbandwidth kicks clients if called within OnClientAuthorized and perhaps other connection stages, I guess since they aren't yet accepting the download.

I modified the extension to add a function to send only to specified clients. Maybe this is a feature that could be added?

The short use case is to cache which players have already downloaded a file to avoid resending.

The longer version is:
The plugin associates a list of files with a server, map, and player, adds those files to a download list for each connected client and has them download it. In order to do this properly, it needs to send files only to specific clients so it can avoid resending to any clients that already have those files.

So for example, a server has:
materials/foo/magic.vtf
sound/foo/neat.wav

The map cp_process_final has:
materials/foo/processthing.vtf

A player has:
materials/foo/superspray.vtf

Another player has:
materials/foo/cooliospray.vtf

It adds all those files to a list and sends them out to all clients that don't already have them. The list changes based on the current map and players in the server.

Backup 02-25-2018 17:14

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by GHartmann (Post 2580112)
Another bug:
latedl_minimalbandwidth kicks clients if called within OnClientAuthorized and perhaps other connection stages, I guess since they aren't yet accepting the download.

I modified the extension to add a function to send only to specified clients. Maybe this is a feature that could be added?

I've modified the code that the connecting clients have additional time. I think that they accept the download, but it is queued and the client is busy exchanging different data. If that is not the case and the client simply drops the download, I'll have to come with a different solution. Please report if you'll find it not working correctly.

I've added another parameter, specifing the target client, zero index means all player as usual.

lugui 02-28-2018 13:31

Re: [EXTENSION] Late Downloads
 
Is there a way to use a third-party service just like a fastdl server? Or it is restricted to the game server upload?

Backup 02-28-2018 16:06

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by lugui (Post 2580659)
Is there a way to use a third-party service just like a fastdl server? Or it is restricted to the game server upload?

Nope, it needs to be transfared by the game server directly. The fastdl server can be used only when connecting.

If you're a hardcore hacker, you might find a way how to downgrade client state to force re-download of resources via fastdl; and then upgrade the state back so the client won't get disconnected. If you're able to do the second part, please PM me :D

DJPlaya 03-01-2018 06:02

Re: [EXTENSION] Late Downloads
 
This seems to be pretty much the same as >this< with more setting possibilities?

lugui 03-01-2018 06:40

Re: [EXTENSION] Late Downloads
 
Maybe there is a way to redirect the traffic.

Quote:

Originally Posted by DJPlaya (Post 2580785)
This seems to be pretty much the same as >this< with more setting possibilities?

Is it possible to add the ability to request files from client with this extension? Sinse it is more "polished" than the functions dordnung found.
Also, can it manage the downloads of a single player??

What are the restrictions for the directorye swhere the extension can save files on client and download from (if possible)?

only from /cuntom/* ?

My idea is if it is possible to download demo files from client or even screenshots, to implement some kind of anticheat plugin

Backup 03-01-2018 08:15

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by DJPlaya (Post 2580785)
This seems to be pretty much the same as >this< with more setting possibilities?

latedl uses the same functions to send the files, but also has reliable forward that fires on download completion. The focus is also somewhat different, latedl was ment to be used in such a way that all connected clients has the same files; while filenetmessages is more single-client oriented.

Quote:

Originally Posted by lugui (Post 2580790)
Also, can it manage the downloads of a single player??

Yep, the last parameter for addlatedownload is a optional one that either takes client's index or zero for file broadcast.

Quote:

Originally Posted by lugui (Post 2580790)
Maybe there is a way to redirect the traffic.

Nope. There is a entirely different piece of code that handles fastdl during connection. These functions (CNetChan::SendFile) are only used as a fallback option when no fastdl is present.

Quote:

Originally Posted by lugui (Post 2580790)
Is it possible to add the ability to request files from client with this extension? Sinse it is more "polished" than the functions dordnung found.
...
My idea is if it is possible to download demo files from client or even screenshots, to implement some kind of anticheat plugin

I'm not sure whether upload from client still works in newer Valve titles, but even if it would, it would be pretty useless, for multiple of reasons. To download anything from client, you need to know it's full name; and the player would need to tell you that full name (i.e. via setinfo). The only exception is fixed name, like for custom sprays. Idea of downloading screenshots from clients is unreal, since you won't be able to trigger screenshot or demo capture in the first place.

lugui 03-01-2018 11:30

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by Backup (Post 2580819)
I'm not sure whether upload from client still works in newer Valve titles, but even if it would, it would be pretty useless, for multiple of reasons. To download anything from client, you need to know it's full name; and the player would need to tell you that full name (i.e. via setinfo). The only exception is fixed name, like for custom sprays. Idea of downloading screenshots from clients is unreal, since you won't be able to trigger screenshot or demo capture in the first place.


Yes, but in theory, if the server can know the file path, can it be pulled?

DJPlaya 03-01-2018 16:40

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by lugui (Post 2580790)
...

>Basically its the same "Function" in the Engine as this Extension here uses, but you do not have any settings so this here is definitly better for uploading to Clients
>You can download anything from inside the Gamefolder, I dont know if this works on CSGO but in TF2 it worked fine and so i guess it does for most of the classy Games.

Ime not exactly sure if its THAT easy to write an anti Cheat that uses demo Files.
The bigger Problem i see is that you do not really have a Way to list Files, and so you need a different Way to gater the demo Filenames or need to invest some more Codelines. I was also thinking of downloading Windows desktop.ini Files but this is going a bit too far, or? ^^
As far as i know the Filename is build out of the
[recording Methode(auto, etc.)}-{Date}-{Record Time}-{Mapname}.dem

Quote:

Originally Posted by Backup (Post 2580819)
...

Have some Bacon for this :bacon!::bacon!::bacon!:
I may edit SM Downloader a bit to implent this Extension

lugui 03-01-2018 18:35

Re: [EXTENSION] Late Downloads
 
You can prompt to the player a DialogType_Menu. It can trigger any console command on the client such as "record unique_name"

I talking about a competitive scenario. It surely is not viable on public servers, but a automatic POV upload whould be extremely usefull for competitive matches

DJPlaya 03-05-2018 14:27

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by lugui (Post 2580916)
You can prompt to the player a DialogType_Menu. It can trigger any console command on the client such as "record unique_name"

I talking about a competitive scenario. It surely is not viable on public servers, but a automatic POV upload whould be extremely usefull for competitive matches

Beside that this Exploit dosent work in CSGO without hacky Extensions, i would suggest you to install EasyAntiCheat on your competitive Servers. It requires the Users to install an Programm via Steam first, still i think this is the best Solution for your Case when you would even go as far and check the Records made.
Link > https://esports.easyanticheat.net/esports/signup/

xm3kilo 04-15-2018 15:44

Re: [EXTENSION] Late Downloads
 
I can't seem to compile this, does anyone have the extension for Windows and csgo?
Cheers

Backup 04-15-2018 16:08

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by xm3kilo (Post 2587886)
I can't seem to compile this, does anyone have the extension for Windows and csgo?
Cheers

Just download the zip file from the github releases page: https://github.com/jonatan1024/latedl/releases

Dragokas 04-30-2018 17:54

Re: [EXTENSION] Late Downloads
 
Hi, Backup!

Thanks a much for your extensions.

Can you please take a look, why I got no files in "build" dir:
Quote:

alex@alex-Lenovo-G710 ~/dev/latedl-master/build $ python ../configure.py --hl2sdk-root=/home/alex/dev/ --mms-path=/home/alex/dev/metamod-source-master/ --sm-path=/home/alex/dev/sourcemod-1.9-dev/ --sdks=csgo
Checking CC compiler (vendor test gcc)... ['cc', 'test.c', '-o', 'test']
found gcc version 5.4
Checking CXX compiler (vendor test gcc)... ['c++', 'test.cpp', '-o', 'testp']
found gcc version 5.4
No errors. But, no .so file.

Also, is it can be build with another's game SDK?

P.S. AMBuildScript script seems not correctly prepared. It require csgo sdk folder should have name "hl2sdk-csgo", but sdk from download link you provided has dir. name "hl2sdk-sdk2013" and can't be found by this python script.

Backup 05-01-2018 07:14

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by Dragokas (Post 2590198)
Hi, Backup!

Thanks a much for your extensions.

Can you please take a look, why I got no files in "build" dir:

No errors. But, no .so file.

Also, is it can be build with another's game SDK?

P.S. AMBuildScript script seems not correctly prepared. It require csgo sdk folder should have name "hl2sdk-csgo", but sdk from download link you provided has dir. name "hl2sdk-sdk2013" and can't be found by this python script.

You need to run the "ambuild" command afterwards configuring.
I have a compile script on my unix machine that looks like this:
Code:

#!/bin/sh
export HL2SDKCSGO=/home/steam/hl2sdk

cd build
python ../configure.py --mms-path=/home/steam/metamod-source/ --sm-path=/home/steam/sourcemod/ --sdks=csgo --enable-optimize && ambuild

The AMBuildScript expects that you have all the sdks stored in a common directory. If you export an enviromental variable, you can directly specify single sdk. I used only slightly modified version of this file and didn't want to change this behaviour completely, since it would behave differently than every other ambuild project.

It can be build against pretty much every source game sdk, just fetch different sdk repo, export different env var and specify different sdk in the command line.

Dragokas 05-01-2018 07:27

Re: [EXTENSION] Late Downloads
 
omg, must run ambuild. Thanks.

Two compilation threads raised errors:
Quote:

1)
In file included from /home/alex/dev/sourcemod-1.9-dev/public/IExtensionSys.h:35:0,
from /home/alex/dev/sourcemod-1.9-dev/public/smsdk_ext.h:41,
from /home/alex/dev/latedl-master/extension.h:40,
from /home/alex/dev/latedl-master/extension.cpp:32:
/home/alex/dev/sourcemod-1.9-dev/public/IShareSys.h:40:25: fatal error: sp_vm_types.h: No such file or directory
#include <sp_vm_types.h>

2)
In file included from /usr/include/stdio.h:27:0,
from /home/alex/dev/sourcemod-1.9-dev/public/smsdk_ext.cpp:32:
/usr/include/features.h:367:25: fatal error: sys/cdefs.h: No such file or directory
Looks like 2 header files is missed.

What SM ver. do you use?

Backup 05-01-2018 07:46

Re: [EXTENSION] Late Downloads
 
Quote:

Originally Posted by Dragokas (Post 2590242)
Looks like 2 header files is missed.

The first one is from sourcepawn. You need to clone the repository with all subrepositories. That is just shitty git behaviour. https://stackoverflow.com/questions/...ing-submodules
The second one is probably from stdlib, make sure you have 32bit libc installed.
Quote:

Originally Posted by Dragokas (Post 2590242)
What SM ver. do you use?

If you have binaries of some version on server, use the branch of the same version.

Dragokas 05-01-2018 07:56

Re: [EXTENSION] Late Downloads
 
ok, sorry. I forgot recursive flag when clone sm.

But there are another errors, I'm not sure I can handle this time:
Quote:

In file included from /home/alex/dev/hl2sdk-csgo/public/tier0/commonmacros.h:15:0,
from /home/alex/dev/hl2sdk-csgo/public/tier0/basetypes.h:11,
from /home/alex/dev/hl2sdk-csgo/public/tier0/dbg.h:15,
from /home/alex/dev/hl2sdk-csgo/public/tier1/convar.h:19,
from /home/alex/dev/hl2sdk-csgo/public/eiface.h:16,
from /home/alex/dev/metamod-source-master/core/ISmmAPI.h:45,
from /home/alex/dev/metamod-source-master/core/ISmmPlugin.h:39,
from /home/alex/dev/sm/sourcemod/public/smsdk_ext.h:100,
from /home/alex/dev/latedl-master/extension.h:40,
from /home/alex/dev/latedl-master/extension.cpp:32:
/home/alex/dev/hl2sdk-csgo/public/tier0/platform.h:727:0: error: "_stricmp" redefined [-Werror]
#define _stricmp stricmp
^
<command-line>:0:0: note: this is the location of the previous definition
/home/alex/dev/latedl-master/extension.cpp: In member function ‘virtual void CExtension::OnGameFrame(bool)’:
/home/alex/dev/latedl-master/extension.cpp:194:66: error: no matching function for call to ‘INetChannel::SendFile(const char*&, int, bool)’
resendSuccess = chan->SendFile(filename, g_TransferID++, false);
^
In file included from /home/alex/dev/latedl-master/extension.cpp:36:0:
/home/alex/dev/hl2sdk-csgo/public/inetchannel.h:50:15: note: candidate: virtual bool INetChannel::SendFile(const char*, unsigned int)
virtual bool SendFile(const char *filename, unsigned int transferID) = 0;
^
/home/alex/dev/hl2sdk-csgo/public/inetchannel.h:50:15: note: candidate expects 2 arguments, 3 provided
/home/alex/dev/latedl-master/extension.cpp: In function ‘int SendFiles(const CUtlVector<const char*>&, int)’:
/home/alex/dev/latedl-master/extension.cpp:329:52: error: no matching function for call to ‘INetChannel::SendFile(const char*&, int&, bool)’
if (chan->SendFile(filename, g_TransferID, false)) {
^
In file included from /home/alex/dev/latedl-master/extension.cpp:36:0:
/home/alex/dev/hl2sdk-csgo/public/inetchannel.h:50:15: note: candidate: virtual bool INetChannel::SendFile(const char*, unsigned int)
virtual bool SendFile(const char *filename, unsigned int transferID) = 0;
^
/home/alex/dev/hl2sdk-csgo/public/inetchannel.h:50:15: note: candidate expects 2 arguments, 3 provided
cc1plus: all warnings being treated as errors
Quote:

In file included from /home/alex/dev/hl2sdk-csgo/public/tier0/commonmacros.h:15:0,
from /home/alex/dev/hl2sdk-csgo/public/tier0/basetypes.h:11,
from /home/alex/dev/hl2sdk-csgo/public/tier0/dbg.h:15,
from /home/alex/dev/hl2sdk-csgo/public/tier1/convar.h:19,
from /home/alex/dev/hl2sdk-csgo/public/eiface.h:16,
from /home/alex/dev/metamod-source-master/core/ISmmAPI.h:45,
from /home/alex/dev/metamod-source-master/core/ISmmPlugin.h:39,
from /home/alex/dev/sm/sourcemod/public/smsdk_ext.h:100,
from /home/alex/dev/sm/sourcemod/public/smsdk_ext.cpp:34:
/home/alex/dev/hl2sdk-csgo/public/tier0/platform.h:727:0: error: "_stricmp" redefined [-Werror]
#define _stricmp stricmp
^
<command-line>:0:0: note: this is the location of the previous definition
cc1plus: all warnings being treated as errors

Backup 05-01-2018 08:14

Re: [EXTENSION] Late Downloads
 
Did you downloaded sdk from this repository from correct branch?
https://github.com/alliedmodders/hl2sdk/tree/csgo

Dragokas 05-01-2018 08:40

Re: [EXTENSION] Late Downloads
 
I downloaded wrong branch.

Backup, thanks again.
Successfully built with SDK I need.

Dragokas 05-22-2018 10:19

Re: [EXTENSION] Late Downloads
 
Hi, Backup!

1) Can you please describe more about behaviour of:
Quote:

* @param addAsStatic When true, files are also added into downloads table as static downloads. On the next call the files are checked against this table to avoid repeated downloads of the same files.
How is it actually work? I thought, you are adding file to AddFileToDownloadsTable in parallel. But I added AddLateDownload to OnMapStart() and I see no black screen.

Personally, I need reliable downloading system. See: If I'm adding several paths and client disconnect on half-way, I don't want to waste traffic. I need to know what files he already downloaded. I cannot rely on OnDownloadSuccess() forward (server could reboot, client could reinstall client e.t.c.). And I cannot use AddLateDownload() again because I noticed it download file again even if client already downloaded that file. Is it possible somehow to know if client already downloaded file? (AddFileToDownloadsTable() function somehow know that information).

P.S. I think, I could resolve it by setting client's cookie for each successfully downloaded file, so my downloader will check for them first before beginning actual download process. It's not a complete solution because user can manually delete some file (without reinstalling the game).

2) Is there any restriction for the number of consecutive calls of AddLateDownload()?
Mean, if I don't want to call array alternative - AddLateDownloads().

3) Is it normal OnDownloadSuccess returns duplicate records:
- one for client ID == 0
- second for the actual client ID.
?

Thanks again,
looking forward for your answer,
Alex.

Dragokas 05-22-2018 12:05

Re: [EXTENSION] Late Downloads
 
++
Do you return client ID real-time (not time-delayed)? Mean, is it reliable that you use ClientID instead of UserID?

Backup 05-22-2018 13:44

Re: [EXTENSION] Late Downloads
 
@Dragokas:
It would be much easier if you would tell me what is your use case, what are you trying to achivie with this extension. I have a strong feeling we're reinventing a wheel here.

If you are calling AddLateDownload at map start, you don't need this extension at all, you can directly add the files into download table.

There is no easy way of checking whether client has the file downloaded. But if I recall correctly, if you call the AddLateDownload function on already existing file, it should immediately call the callback signaling succes. I'm not sure, I'd have to check.

Quote:

Originally Posted by Dragokas (Post 2593306)
Is there any restriction for the number of consecutive calls of AddLateDownload()?
Mean, if I don't want to call array alternative - AddLateDownloads().

AddLateDownloads is pretty much just a wrapper around AddLateDownload. So call it as much as you want.

Quote:

Originally Posted by Dragokas (Post 2593306)
Is it normal OnDownloadSuccess returns duplicate records:
- one for client ID == 0
- second for the actual client ID.
?

Yes, as stated in the documentation:
Code:

/**
 * Called when client successfully downloaded a file. This forward might be called before AddLateDownload(s) returns!
 *
 * @param iClient                Client index. Index 0 signals removal of the file from the download queue - all clients downloaded or failed to download the file. 
 * @param filename                Name of the successfully downloaded file.
 */

Quote:

Originally Posted by Dragokas (Post 2593332)
Do you return client ID real-time (not time-delayed)? Mean, is it reliable that you use ClientID instead of UserID?

Yes. You won't get fresher ClientID than this. I have the most real-timey ClientIDs in town.

Dragokas 05-22-2018 14:05

Re: [EXTENSION] Late Downloads
 
Thanks.

Quote:

Originally Posted by Backup
... what are you trying to achivie with this extension

Goal is: to avoid black screen (happened if you use AddFileToDownloadsTable() in OnMapStart()).
It was just a test. I don't plan to use in on map load. Instead, AddLateDownload() will be in OnClientPostAdminCheck().

Quote:

... it should immediately call the callback signaling succes. I'm not sure, I'd have to check.
It is not do that way. Using current version of your extension, I need to wait a long time while it re-download all files that already downloaded.
Yes, extension show in console that file is already downloaded (but not at once) => it try to download it and it waste time and traffic.

Anyway, I already made a plugin that uses client's cookies to store download history.
I'll post it here if you don't mind as soon as I made little optimizations.

Dragokas 05-22-2018 16:05

Re: [EXTENSION] Late Downloads
 
1) Is it possible to implement StopDownload() method?

Because I'm getting "You have insufficient bandwidth" game engine message and get kicked from the server during map transition.

2) Can you hide or change msg err. level of:
Quote:

L 05/22/2018 - 19:59:04: [LATEDL] Lost client 1 when sending file 'models/survivors/alicew.mdl'!
because that msg spam with a LOT of lines in error log file.
To be honest, it is not informative; not sure admin needs that info especially in err. log together with a real errors raised by critical errors in plugins.
It's better to just display it in console as usual msg type, not an error.

3) Also, during gameplay I got spam of such error with complete freeze of client:
Quote:

xx.xx.xx.xx:27243:send reliable stream overflow
xx.xx.xx.xx:27243:send reliable stream overflow
xx.xx.xx.xx:27243:send reliable stream overflow
Disconnect: Dragokas timed out.
After a while, my client is disconnected.

Edit. So, my client is constantly freeze if it download file ~ 10 MB. Maybe, you know some server Cvar, responsible for the size of max. bandwidth?

4) Does "Late download" extension has the code to kick players? O_o
Quote:

L 05/23/2018 - 01:15:37: [LATEDL] Client 5 ('Zed3rs0n', xx.xx.xx.xx:27005) had insufficient bandwidth (<64 kbps), failed to receive 'materials/models/survivors/vipersa2iqs/alisa_head_wrp.vtf' in time! Kicking!
5) Also, not sure is it important, maybe this error in client console go from your extension:
Quote:

CNetChan::SetMaxBufferSize: cant preserve exiting data 5501>4000.
6) Is it possible, extention not to spam with .ztmp files all over the server with every file it try to download to client? At least, it could clear it right after successfull downloading (or if file already exist on client side)?

7) What .ztmp actually intended for?
What if several clients are trying to download the same file? (so, as I can see, extension will use the same .ztmp file name? and will fail?)

8 ) Is it possible somehow to increase download speed? For me currently it's like ~ from 2 to 7 KB/s. Terribly.

Dragokas 05-22-2018 18:29

Re: [EXTENSION] Late Downloads
 
1 Attachment(s)
As I promised before, here is sm_downloader plugin by SWAT_88, forked by me to support "Late Downloader" extension.

It doesn't download same file twice. It store successfully downloaded files in client's cookies.
It also doesn't send all files in download queue together. It set new file for downloading right after successfull/failure with a previous file.
For me, currently it's work quite well.

But, I think currently it's useless until you at least fix "kick players" issue.
I tryed to change server settings for max bandwidth:
Code:

sv_maxrate "0"
It helped somehow, at least for me not to be kicked at map transition.
But other players get kicked even during gameplay.
Here is my full network settings:
Code:

sm_cvar sv_client_min_interp_ratio 0
sm_cvar sv_client_max_interp_ratio 2
sm_cvar sv_client_predict 1
sm_cvar nb_update_frequency 0.1
sm_cvar sv_unlag 1
sm_cvar sv_maxunlag 0.5
sm_cvar net_splitpacket_maxrate 1048576
sv_minupdaterate "20"
sv_maxupdaterate "66"
sv_mincmdrate "30"
sv_maxcmdrate "66"
sv_minrate "80000"
sv_maxrate "0"



All times are GMT -4. The time now is 22:53.

Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.