Raised This Month: $ Target: $400
 0% 

[L4D] Team Restarts Server Modification / Help Requests


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Darkwob
BANNED
Join Date: Oct 2018
Old 09-01-2020 , 06:59   [L4D] Team Restarts Server Modification / Help Requests
Reply With Quote #1

so how do we add time to this, for example?;

!restart 5

or

!restart 10 like

after the numerical values we wrote, the server should restart itself. but can't anything count backwards from 10 by default when the numeric value is not typed ?


PHP Code:
#pragma semicolon 1
#include <sourcemod>
#pragma newdecls required

int    TimerUpdate;
char   file[PLATFORM_MAX_PATH], id_player[32];
Handle count null;

public 
Plugin myinfo 
{
    
name "[L4D] Team Restarts Server.",
    
author "AlexMy",
    
description "",
    
version "1.1",
    
url "https://forums.alliedmods.net/showthread.php?p=2548680#post2548680"
};

public 
void OnPluginStart()
{
    
LoadTranslations("l4d_restart.phrases");
    
    
count CreateConVar("l4d_restart_time""11""Через сколько секунд сервер перезагрузится"FCVAR_NOTIFY);
    
    
RegAdminCmd("sm_restart"sm_restartADMFLAG_GENERIC);
    
RegAdminCmd("sm_rst",     sm_restartADMFLAG_GENERIC);
}
public 
Action sm_restart(int clientint args)
{
    if(
client)
    {
        
TimerUpdate GetConVarInt(count);
        
CreateTimer(1.0timer_start_TIMER_REPEAT);
        
GetClientName(clientid_playersizeof(id_player));
        
BuildPath(Path_SMfilesizeof(file), "logs/restart_server.log");
        
LogToFileEx(file"Admin %s rebooted the server"id_player);
        
PrintToChat(client"%t""admin_warning"id_player);
    }
    return 
Plugin_Handled;
}
public 
Action timer_start(Handle timer)
{
    
TimerUpdate --;
    if(
TimerUpdate 0)
    {
        
PrintHintTextToAll("%t""countdown_timer"TimerUpdate);
        return 
Plugin_Continue;
    }
    
CreateTimer(0.5restart_server_PrintHintTextToAll("%t""warning_restart"));
    return 
Plugin_Stop;
}
public 
Action restart_server(Handle timer)
{
    
ServerCommand("exit");
    return 
Plugin_Stop;

Darkwob 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 03:07.


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