Raised This Month: $154 Target: $400
 38% 

Automatic demo recording v1.6.4 (steambans support added)


Post New Thread Reply   
 
Thread Tools Display Modes
Author
Timiditas
Senior Member
Join Date: Apr 2009
Plugin ID:
1040
Plugin Version:
1.6.4
Plugin Category:
Server Management
Plugin Game:
Any
Plugin Dependencies:
    Servers with this Plugin:
    5 
    Plugin Description:
    Makes sure sourceTV bot spawns on server (re)start/crash and starts/stops recording depending on presence of human clients
    Old 07-25-2009 , 21:34   Automatic demo recording v1.6.4 (steambans support added)
    Reply With Quote #1

    _

    new in v1.6.4
    - removed the need of the file autodemo_changemap.cfg
    plugin will just restart the map that is currently running if sourcetv fakeclient is absent

    - new cvar: sm_autodemo_playercount - default 2
    recording is started only if this amount of REAL players are on the server


    Required server settings:
    tv_enable 1
    tv_autorecord 0 (!)


    Well I have sourceTV record everything for quite some time now.
    And it bugged me that it recorded demos even if nobody was on the server, so our available space got hooked pretty quick.

    This plugin checks the presence of HUMAN clients on connection and disconnection of players, and starts/stops the sourceTV recording feature.

    Also, if your server has just been started, or it crashed and auto-restarted, it changes to a new map so the sourceTV bot will connect.

    When you run this plugin, make sure the cvar tv_autorecord
    is set to ZERO!

    The only hooked event is player_team, so this plugin works on all source mods that support this event.

    Update to 1.2
    Just a small but crucial bugfix that prevented recording after a mapchange

    v1.2d, nothing changed except for debug messages and logging
    log goes to "autodemo_smx.log" in the sourcemod log folder.
    timed checks, critical faults are logged to autodemo_smx_critical.log

    v1.3 - bugfix, exchanged "OnClientDisconnect" for "OnClientDisconnect_Post"
    exchanged hooked event with "OnMapStart"-forward

    v1.4
    Code:
    sm_autodemo_filename_format "%m-%d-%y %H.%M-*H.*M *MAP"
    
    Filename format of the demos.
     Default: "%m-%d-%y %H.%M-*H.*M *MAP"
    Note that you cannot use asterisks. I use them as escape char here for map name and ending time.
    For the ending time, only *H and *M are supported. They equal %H and %M
    I will NOT check if you use invalid filename characters for your target platform
    AFAIK, unix supports colons in filenames. Windows does not. Just stick to dots.
    
    For supported % placeholders, refer to:
    http://cplusplus.com/reference/clibrary/ctime/strftime/
    
    
    
    Do not record when there are only spectators
     Default: "1"
    sm_autodemo_ignore_spectators "1"
    
    
    0 = Don't delete old demos, 1 = Check on mapchange only, 2 = Check every x seconds(ttl_tick)
     Default: "1"
    sm_autodemo_ttl_checkmode "1"
    
    Hours to keep demos on disk before deletion. default = 168 = 7 days
     Default: "168"
    sm_autodemo_ttl_hours "168"
    
    Interval in seconds, that are checked for old demos that can be deleted
     Default: "120.0"
    sm_autodemo_ttl_tick "120.0"
    
    Recording is started only if this amount of REAL players are on the  server. Must be >0
     Default: "2"
    sm_autodemo_playercount "2"
    The console command
    sm_autodemo_query
    tells you if recording is in progress currently, and to what file.


    v1.5
    a thousands of bugfixes and re-design

    sm_autodemo_steambans cvar has been removed, due to some engine limitations. See start of this posting.

    The "status" command has been replaced by a logging function. You get a .log file that has the same name
    as the demofile, where the 'simulated' status output goes into, so you have the SteamIDs of the players.
    These will be deleted together with the demofile if they exceed TTL.

    v1.6
    sm_autodemo_ttl_hours * changed
    // Hours to keep demos on disk before deletion. Default unlimited (0). Must be >=1 otherwise its unlimited.
    // Having this, and ttl_kilobyte = 0 overrides ttl_checkmode to 0
    // Default: "0"
    sm_autodemo_ttl_hours "0"

    sm_autodemo_ttl_kilobyte * added
    // Max size in kilobytes of demos before the oldest gets deleted. Default unlimited (0). Must be >=51200 otherwise its unlimited. Max size is 4294967295 KB = 3,9 Therabyte
    // Having this, and ttl_hours = 0 overrides ttl_checkmode to 0
    // Default: "0"
    sm_autodemo_ttl_kilobyte "0"

    Note that ttl_kilobyte takes only completed demos into account.
    This can be changed, if someone demands.
    If any of ttl_kilobyte, ttl_hours or ttl_checkmode is 0, no new demofile will be written to the log!!
    (The demo is written to the log after the recording has been stopped. So you could use this to prevent certain single demos from being deleted)

    1.6.1
    Fixed plugin thinking dead players are spectators
    1.6.2
    Improved SourceTV detection.
    New CVAR:
    sm_autodemo_mapchange
    - Do a mapchange if SourceTV absent
    0 = never, 1 = once, 2 = always
    Default: 1

    Added optional checking if new plugin version is available.
    This feature depends on socket extension.
    If you want to enable that feature, you must uncomment
    //#define SOCKET_ENABLED // Comment this line out to disable Sockets. this line at the top and recompile. (You will need the file socket.inc from the sockets extension in your scripting folder)
    If enabled, it writes a message into SourceMods error log, the new version number and where to get it.

    1.6.3
    Update check feature dropped
    Autodemo Plugin now supports SteamBans plugin
    sb_status is automatically fired when a new player connects and SteamBans was detected running.
    The fake status textfiles are now optional and can be deactivated by setting the cvar sm_autodemo_fakestatus_file to 0

    v1.6.4
    - removed the need of the file autodemo_changemap.cfg
    plugin will just restart the map that is currently running if sourcetv fakeclient is absent

    - new cvar: sm_autodemo_playercount - default 2
    recording is started only if this amount of REAL players are on the server
    Attached Files
    File Type: sp Get Plugin or Get Source (autodemo.sp - 2124 views - 19.7 KB)
    __________________


    Last edited by Timiditas; 07-01-2010 at 13:02.
    Timiditas is offline
    krod
    Member
    Join Date: Oct 2006
    Old 07-28-2009 , 00:58   Re: Automatic demo recording v1.2 SUSPENDED
    Reply With Quote #2

    Good work! We have been looking for this for a while, keep it up!

    Also in the future there should be an option to determine how long it saves the demos for to prevent it from eating HDD space
    __________________

    krod is offline
    Timiditas
    Senior Member
    Join Date: Apr 2009
    Old 07-28-2009 , 05:16   Re: Automatic demo recording v1.2 SUSPENDED
    Reply With Quote #3

    Count that to be on my todo list at the top. =)
    __________________

    Timiditas is offline
    Timiditas
    Senior Member
    Join Date: Apr 2009
    Old 07-28-2009 , 07:27   Re: Automatic demo recording v1.2d SUSPENDED
    Reply With Quote #4

    Re-uploaded plugin. 1.2d is a debug version with logging (consumes slightly more CPU).
    If anyone is willing to help, use this version and if you run into problems, send me both logfiles of this plugin together with the information when the problem occured. (date/time or linenumber in your logfile).

    I only had it one time yet, that the recording didn't stop.
    Before that happened, an admin idled as spectator on the server for a while.
    One other client came, they jerked around for a minute, then both left.
    Recording should have stopped at that point but it didn't. I gotta reproduce that situation yet.

    @krod, concerning deletion of old demos:
    What "time-to-live" cvar would you prefer? Days or Hours?
    And how should "old" demos be handled that are still being recorded to?
    Imagine this situation:
    Someone set the TTL cvar to 8 hours (very impractical, I know. This is just an example). Then his server is busy for the full time.

    I think I will add a database where filenames of all demo records that this plugin triggered, go into, so it won't touch anything else.
    __________________


    Last edited by Timiditas; 07-28-2009 at 10:25.
    Timiditas is offline
    Timiditas
    Senior Member
    Join Date: Apr 2009
    Old 07-28-2009 , 13:56   Re: Automatic demo recording v1.2d SUSPENDED
    Reply With Quote #5

    Was able to recreate the incident. I joined the empty server as spectator only and left again without joining a team.
    Thing is, my server spawns one bot per default when you are alone. Since that bot leaves AFTER you leave, this plugin stops recording normally because on the second disconnect (the bot) it knows that no humans are left.
    But if you never join a team, there is no bot that can leave after you, so the recording won't stop.
    It is because when the forward OnClientDisconnect is fired, the disconnecting client is still registered as a connected client, filling a slot. So the plugin won't really register that there is nobody left.

    I'll switch from OnClientDisconnect to OnClientDisconnect_Post. Will upload update in a few hours.
    __________________

    Timiditas is offline
    zeroibis
    Veteran Member
    Join Date: Jun 2007
    Old 07-28-2009 , 22:18   Re: Automatic demo recording v1.3
    Reply With Quote #6

    Personally I think that the option for clearing the demos should be days as your not going to eat that much HDD in 24 hours. As far as demo organization goes I assume that you must start a new demo every map change. However the easiest way to look up demos would be by time and thus I suggest the following name system: MM-DD-YY hh:mm-hh:mm map_name.dem Such a name system would force it so that users could easily organize files by date without halting to worry about their oc or something messing with the file info and then throwing the system out of whack.

    Also, I have a few suggestions for some future features:
    auto sb_status -great feature for catching hackers!
    ability to only record when players are on a team: this prevents recording if there is just one player sitting in spec with no one else in the server actually playing.
    __________________
    zeroibis is offline
    Timiditas
    Senior Member
    Join Date: Apr 2009
    Old 07-28-2009 , 22:38   Re: Automatic demo recording v1.3
    Reply With Quote #7

    Quote:
    Originally Posted by zeroibis View Post
    Personally I think that the option for clearing the demos should be days as your not going to eat that much HDD in 24 hours.
    I have now chosen hours for "sm_autodemo_ttl_hours". Default is 168, that would be 7 days. You can still go up all the way you like.
    Quote:
    Originally Posted by zeroibis View Post
    As far as demo organization goes I assume that you must start a new demo every map change.
    Yes, because the sourcetv bot is also disconnected on map change, and that automatically stops demo recording.
    Quote:
    Originally Posted by zeroibis View Post
    However the easiest way to look up demos would be by time and thus I suggest the following name system: MM-DD-YY hh:mm-hh:mm map_name.dem Such a name system would force it so that users could easily organize files by date without halting to worry about their oc or something messing with the file info and then throwing the system out of whack.
    I will add a cvarString, so anyone can choose their own formating rule by setting a string. Then the CURRENT default would look like this:
    auto-%Y%m%d-%H%M-
    for the prefix. However I think I'll make your suggestion the default.
    Quote:
    Originally Posted by zeroibis View Post
    Also, I have a few suggestions for some future features:
    auto sb_status -great feature for catching hackers!
    For that, I'd need some help/testers. I don't have any experience with steambans, we don't use it. I don't even know what sb_status does
    Quote:
    Originally Posted by zeroibis View Post
    ability to only record when players are on a team: this prevents recording if there is just one player sitting in spec with no one else in the server actually playing.
    I have already implemented that as a cvar "sm_autodemo_ignore_spectators", coming with v1.4
    The keyvalues handling is finished, I only need to add one or two lines for the file deletion commands. Then I can upload it. But now, I'll take a break. Its 047am. *yawn*
    __________________

    Timiditas is offline
    Timiditas
    Senior Member
    Join Date: Apr 2009
    Old 07-29-2009 , 08:06   Re: Automatic demo recording v1.4
    Reply With Quote #8

    First post updated with new SP / CFG file and description.

    I thought about implementing a SIZE limit for all the files as well

    Now whats up with sb_status? I'll read into that...

    ~edit

    As far as I understand it, I would have to issue the sb_status command everytime somebody has joined, correct?
    And the output of that will be recorded in the demo??
    How do I have to picture that?

    When somebody is playing that demo, he will see the console messages automatically?
    __________________


    Last edited by Timiditas; 10-13-2009 at 17:53.
    Timiditas is offline
    zeroibis
    Veteran Member
    Join Date: Jun 2007
    Old 07-30-2009 , 15:56   Re: Automatic demo recording v1.4
    Reply With Quote #9

    sb_status is a bit like status and outputs the steamids of clients into console. It is required by steambans to submit a demo for banning. If you decide to add support for it I can test it on my home computer even to see that it works. I have local copies of all of my servers that I use for testing. They do connect to steambans when I run them so it is possible for me to see that it records the data correctly and is up to the standards of steambans.

    And yes if someone is watching the demo the outputs should show up in console.

    Hopefully with a great tool like this we can finally put every hacker in his place

    Also rather than try to limit the size you could force it to start a new demo every x min. If you figure that every min of demo is about 2mb than you could translate it that way.

    edit: oh I had a great idea for a long term update! Ability to auto compress demos older than X.
    __________________

    Last edited by zeroibis; 07-30-2009 at 16:05.
    zeroibis is offline
    Timiditas
    Senior Member
    Join Date: Apr 2009
    Old 07-30-2009 , 16:25   Re: Automatic demo recording v1.4
    Reply With Quote #10

    So, to get that clear, it would suffice to issue an sb_status on every client connect, right?
    Is there a public cvar that steambans registers, that I can check for if steambans is installed?
    If not, I'll just use a cvar myself that the admin must set via cfg, so sb_status gets called.

    ~

    Regarding filesizes, splitting would work I think. But it would be VERY unconvenient for the peeps watching the demos.

    ~

    I doubt that filecompression is possible via sourcemod.

    ~edit:
    I have attached a version for anyone that is willing to test, that executes sb_status on every new client connection if the new cvar "sm_autodemo_steambans" is set to 1.
    If you already have the config file in your cfg/sourcemod directory, you need to add that cvar by hand.
    Is there any cvar that steambans registers on the server, that I could automatically check for if steambans is installed?
    __________________


    Last edited by Timiditas; 08-02-2009 at 18:12.
    Timiditas is offline
    Reply


    Thread Tools
    Display Modes

    Posting Rules
    You may not post new threads
    You may not post replies
    You may not post attachments
    You may not edit your posts

    BB code is On
    Smilies are On
    [IMG] code is On
    HTML code is Off

    Forum Jump


    All times are GMT -4. The time now is 02:48.


    Powered by vBulletin®
    Copyright ©2000 - 2017, vBulletin Solutions, Inc.
    Theme made by Freecode