View Single Post
Cruze
Veteran Member
Join Date: May 2017
Old 07-03-2020 , 06:56   Re: [CSGO][PugSetup] RoundRestore
Reply With Quote #7

Quote:
Originally Posted by borzaka View Post
Couple of suggestions:
  • prefix is not always backup_round, it can be set to any custom by mp_backup_round_file cvar
    I have multi instance servers, where I have to set this to different values to not overwrite each other.
  • You can use completely different backup file name patterns by mp_backup_round_file_pattern cvar
    e.g. %prefix%_%date%_%time%_%team1%_%team2%_%map%_ round%round%_score_%score1%_%score2%.txt
  • mp_backup_restore_load_file pauses automatically after executing mp_backup_restore_load_file, if the mp_backup_restore_load_autopause cvar left default, no need to pause again

So, I would pay attention to custom backup file prefixes and names and use the values from cvars.
Hmm, that's a good catch. Would if I do this? I don't know much about this cvars.

PHP Code:
        char filepath[PLATFORM_MAX_PATH];
    
char num[5];
    
Format(filepathsizeof(filepath), "%s"g_BackupPrefixPattern);
    
ReplaceString(filepathsizeof(filepath), "%prefix%"g_BackupPrefix);
    if(
round 10)
    {
        
Format(numsizeof(num), "0%d"round);
        
ReplaceString(filepathsizeof(filepath), "%round%"num);
    }
    else
    {
        
Format(numsizeof(num), "%d"round);
        
ReplaceString(filepathsizeof(filepath), "%round%"num);
    }
    
ServerCommand("mp_backup_restore_load_file %s"filepath); 
Code:
public void OnMapStart()
{
	FindConVar("mp_backup_round_file").GetString(g_BackupPrefix, sizeof(g_BackupPrefix));
	FindConVar("mp_backup_round_file_pattern").GetString(g_BackupPrefixPattern, sizeof(g_BackupPrefixPattern));
	
	ServerCommand("mp_backup_restore_load_autopause 0");
	ServerCommand("mp_backup_round_auto 1");
}
EDIT: After F-ing up my mind, I couldn't think of any way to replace this with old round's prefix :/ "%date%_%time%_%team1%_%team2%_%map%_ round%round%_score_%score1%_%score2%"
"%map%" can be possible but rest, I don't know. Any help would be appreciated!
__________________
Taking paid private requests! Contact me

Last edited by Cruze; 07-03-2020 at 14:26. Reason: edit
Cruze is offline