View Single Post
Bugsy
AMX Mod X Moderator
Join Date: Feb 2005
Location: NJ, USA
Old 04-05-2020 , 14:46   Re: [CS 1.6] Huge problem with 'users.ini'
Reply With Quote #12

Ideally you should find the source of the problem instead of applying band-aids. Might be difficult though with the number of plugins you are running.

Untested
PHP Code:

#include <amxmodx>
#include <nvault>

new const Version[] = "0.1";

new 
g_pNumRounds;

public 
plugin_init() 
{
    
register_plugin"Server Restarter" Version "bugsy" );
    
    new 
iVault nvault_open"server_restart" );
    new 
szNextMap64 ];
    
    if ( 
nvault_getiVault "NextMap" szNextMap charsmaxszNextMap ) ) )
    {
        
nvault_removeiVault "NextMap" );
        
nvault_closeiVault );
        
server_cmd"changelevel ^"%s^"" szNextMap );
        return;
    }
    
    
nvault_closeiVault );
    
    
g_pNumRounds register_cvar"server_restart_rounds" "50" );
    
    
register_logevent"RoundEnd" "1=Round_End" );
}

public 
RoundEnd()
{
    new 
iVault nvault_open"server_restart" );
    new 
iNumRounds szRounds] , szNextMap64 ];
    
    
iNumRounds nvault_getiVault "NumRounds" );
    
    if ( ( 
iNumRounds ) >= get_pcvar_numg_pNumRounds ) )
    {
        
get_cvar_string"amx_nextmap" szNextMap charsmaxszNextMap ) );
        
nvault_setiVault "NextMap" szNextMap );
        
nvault_setiVault "NumRounds" "0" );
        
nvault_closeiVault );
        
server_cmd"restart" );
    }
    else
    {
        
num_to_striNumRounds szRounds charsmaxszRounds ) );
        
nvault_setiVault "NumRounds" szRounds );
        
nvault_closeiVault );
    }

__________________
Bugsy is offline