Raised This Month: $51 Target: $400
 12% 

Simple Auto Demo Record !


Post New Thread Reply   
 
Thread Tools Display Modes
Flick3rR
Veteran Member
Join Date: Feb 2014
Location: Bulgaria, Stara Zagora
Old 07-11-2014 , 11:11   Re: Simple Auto Demo Record !
Reply With Quote #11

Just find the lines, where the demo recording are started - the line with "client_cmd(id, "record....". And here, in the function where demo starts, just set another task with the time you want to stop the demo. (5 minutes = 5 x 60 = 300.0 task time). In the task function, just end up with something like
PHP Code:
client_cmd(id"stop")
client_print(idprint_chat"Demo recording has been stopped!"
And don't forget to check if use is connected after such a time delay!
__________________
Flick3rR is offline
Send a message via Skype™ to Flick3rR
amxx_seRo
Junior Member
Join Date: Jul 2014
Old 07-11-2014 , 12:46   Re: Simple Auto Demo Record !
Reply With Quote #12

Ok,

I did it but I think is very unorthodox, as I said I'm not very familiar with amxx language. here it is:

PHP Code:

#include <amxmodx>
#define PLUG_ADMIN        ADMIN_LEVEL_G    //Access flag required to bypass demo recording if amx_demo_disableforadmins=1
#pragma semicolon 1

new g_Toggleg_DModg_UseNIg_RStartAfterg_DemoNameg_DemoNamePrefixg_DisForAdm;

public 
plugin_init() { 
    
register_plugin"Auto Demo Recorder""1.5""IzI" );
    
g_Toggle         register_cvar"amx_demo",        "1" );
    
g_DMod            register_cvar"amx_demo_mode",    "0" );
    
g_UseNI         register_cvar"amx_demo_steamid",    "0" );
    
g_RStartAfter         register_cvar"amx_demo_rectime",    "15" );    // If it is less than 5, it will automatically set to 5, but willn't apply the changes to the console. I recommend to use default settings.
    
g_DemoName         register_cvar"amx_demo_name",    "Autorecorded demo" );
    
g_DemoNamePrefix    register_cvar"amx_demo_prefix",    "AMXX" );
    
g_DisForAdm        register_cvar"amx_demo_disableforadmins","1" );
    
register_dictionary"demorecorder.txt" );
}

public 
client_putinserverid ) {
    if( 
get_pcvar_numg_Toggle ) ) {
        new 
Float:delay get_pcvar_floatg_RStartAfter );
        if( 
delay )
            
set_pcvar_floatg_RStartAfter, ( delay 5.0 ) );
        
set_taskdelay"Record"id );
    }
}

public 
Recordid ) {
    if( !
is_user_connectedid ) || get_pcvar_numg_Toggle ) != || get_pcvar_numg_DisForAdm ) == && get_user_flags(id) & PLUG_ADMIN )
        return;
    
    
// Getting time, client SteamID, server's name, server's ip with port.
    
new szSName[128], szINamePrefix[64], szTimedata[9];
    new 
iUseIN get_pcvar_numg_UseNI );
    new 
iDMod get_pcvar_numg_DMod );
    
get_pcvar_stringg_DemoNamePrefixszINamePrefix63 );
    
get_time "%H:%M:%S"szTimedata);

    switch( 
iDMod ) {
        case 
0get_pcvar_stringg_DemoNameszSName127 );
        case 
1get_user_ip0szSName127);
        case 
2get_user_name0szSName127 );
    }

    if( 
iUseIN ) {
        new 
szCID[32];
        
get_user_authididszCID31 );
        
formatszSName127"[%s]%s"szCIDszSName );
    }

    
// Replacing signs.
    
replace_allszSName127":""_" );
    
replace_allszSName127".""_" );
    
replace_allszSName127"*""_" );
    
replace_allszSName127"/""_" );
    
replace_allszSName127"|""_" );
    
replace_allszSName127"\", "_" );
    replace_all( szSName, 127, "
?", "_" );
    replace_all( szSName, 127, "
>", "_" );
    replace_all( szSName, 127, "
<", "_" );
    replace_all( szSName, 127, " ", "
_" );

    // Sending commands to client.
    client_cmd( id, "
stoprecord ^"%s^"", szSName );
    set_task ( 60.0, "
StopRec", id);
}
    
public StopRec( id ) {    
    if( !is_user_connected( id ) || get_pcvar_num( g_Toggle ) != 1 || get_pcvar_num( g_DisForAdm ) == 1 && get_user_flags(id) & PLUG_ADMIN )
        return;
        
    client_cmd(id, "
stop");
    client_print(id, print_chat, "
Demo recording has been stopped!");
    

I've added the last 7 lines of code (I stopped after 60 sec just for test).
PHP Code:
.....
    
set_task 60.0"StopRec"id);
}
    
public 
StopRecid ) {    
    if( !
is_user_connectedid ) || get_pcvar_numg_Toggle ) != ||  get_pcvar_numg_DisForAdm ) == && get_user_flags(id) &  PLUG_ADMIN )
        return;
        
    
client_cmd(id"stop");
    
client_print(idprint_chat"Demo recording has been stopped!");
    

I believe is not the best way to do it but it works.

Now I have another idea and I want to ask for your help one more time.
I want to repeat the task, the Original task in in the script where the function Record is called, after an amount of time, lets say 5 min. Is this the right way to do it?

Original version:
PHP Code:
public client_putinserverid ) {
    if( 
get_pcvar_numg_Toggle ) ) {
        new 
Float:delay get_pcvar_floatg_RStartAfter );
        if( 
delay )
            
set_pcvar_floatg_RStartAfter, ( delay 5.0 ) );
        
set_taskdelay"Record"id );
    } 
My Version:
PHP Code:
public client_putinserverid ) {
    if( 
get_pcvar_numg_Toggle ) ) {
        new 
Float:delay get_pcvar_floatg_RStartAfter );
        if( 
delay )
            
set_pcvar_floatg_RStartAfter, ( delay 5.0 ) );
        
set_taskdelay"Record"id,  repeat 300.0);
    } 
I found the solution in here http://www.amxmodx.org/funcwiki.php?...=1368#comments
amxx_seRo is offline
amxx_seRo
Junior Member
Join Date: Jul 2014
Old 07-11-2014 , 13:02   Re: Simple Auto Demo Record !
Reply With Quote #13

my mistake, actually should be like this:

PHP Code:
public client_putinserverid ) {
    if( 
get_pcvar_numg_Toggle ) ) {
        new 
Float:delay get_pcvar_floatg_RStartAfter );
        if( 
delay )
            
set_pcvar_floatg_RStartAfter, ( delay 5.0 ) );
        
set_taskdelay"Record"id"a"); 
But is not working

Any Idea ?
amxx_seRo is offline
Reply



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 07:51.


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