Raised This Month: $ Target: $400
 0% 

Server Restart Modification / Help Requests/ can Authors help?


  
 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Author Message
Darkwob
BANNED
Join Date: Oct 2018
Old 09-24-2020 , 06:09   Server Restart Modification / Help Requests/ can Authors help?
Reply With Quote #1

I want to add adjustable time to this plugin, but I couldn't. I also want to have it write "server shutdown" after the countdown instead of "server disconnected".

sample adjustable time.

!restart 5
after typing, restart the server after 5 seconds.
if you don't write anything and just say !restart let it after 10 seconds when we type restart.


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""10""Через сколько секунд сервер перезагрузится"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
 



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:24.


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