Raised This Month: $32 Target: $400
 8% 

Server Restart Modification / Help Requests/ can Authors help?


Post New Thread Reply   
 
Thread Tools Display Modes
Darkwob
BANNED
Join Date: Oct 2018
Old 09-26-2020 , 21:18   Re: Server Restart Modification / Help Requests/ can Authors help?
Reply With Quote #21

Quote:
Originally Posted by Silvers View Post
Your server does auto restart on crash, so running "quit" from server console should make it restart. Try it. "sm_rcon quit" from client.
It is not in case the server crashes, when the lag (players ping) on ​​the server starts to increase, and according to my experience, lag starts when the minimum uptime exceeds 9 hours. So I want the Server to auto restart when the uptime Time is 10 hours.
Darkwob is offline
Bacardi
Veteran Member
Join Date: Jan 2010
Location: mom's basement
Old 09-27-2020 , 01:03   Re: Server Restart Modification / Help Requests/ can Authors help?
Reply With Quote #22

@Darkwob, give us "yes" or "no" answer.
Does your server start back up, even you quit server ?



*edit
There is [ANY] Server Crontab
You can schedule server shutdown(s) with this also.

Last edited by Bacardi; 09-27-2020 at 04:05.
Bacardi is offline
Darkwob
BANNED
Join Date: Oct 2018
Old 09-27-2020 , 15:20   Re: Server Restart Modification / Help Requests/ can Authors help?
Reply With Quote #23

Quote:
Originally Posted by Bacardi View Post
@Darkwob, give us "yes" or "no" answer.
Does your server start back up, even you quit server ?



*edit
There is [ANY] Server Crontab
You can schedule server shutdown(s) with this also.
Now this plugin works the way I want, but after talking to a friend from Germany, I ask if we can make this plugin automatically restart when it reaches a certain uptime, if there is no admin on the server.
Darkwob is offline
Caaine
Member
Join Date: Oct 2013
Old 07-03-2022 , 05:07   Re: Server Restart Modification / Help Requests/ can Authors help?
Reply With Quote #24

Quote:
Originally Posted by Bacardi View Post
I'm not 100% sure what you request...
Also I was playing with SQLite, with this you can get UNIX timestamp to specific time of the (any) day.

old


updated
PHP Code:
#include <sdktools>

Database MyDataBase;

int timestamp;

public 
void OnPluginStart()
{
    
AddCommandListener(listencmd"timeleft");

    
Start();
}

void Start()
{

    if(
MyDataBase == null)
        
MyDataBase SQLite_UseDatabase("storage-local"""0);

    
// Get UNIXTIME, compensate with local time, today's 5:00
    
DBResultSet query SQL_Query(MyDataBase"SELECT strftime('%s','now','start of day','+5 hours','-1 seconds','utc')");
    
timestamp SQL_FetchInt(query0);

    

    if( (
timestamp GetTime()) < )
    {
        
delete query;

        
query SQL_Query(MyDataBase"SELECT strftime('%s','now','start of day','+1 day','+5 hours','-1 seconds','utc')");
        
timestamp SQL_FetchInt(query0);
    }

    
//PrintToServer("seconds %i", timestamp - GetTime());

    
CreateTimer(1.0MyTimer_TIMER_REPEAT);
    
    
delete query;
    
delete MyDataBase;
}

public 
Action listencmd(int client, const char[] commandint argc)
{
    
int timeleft timestamp GetTime();

    
char buffer[60];
    
FormatTime(buffersizeof(buffer), NULL_STRINGtimestamp);

    
ReplyToCommand(client"[SM] Restart server in \
                            %02iHours %02iMinutes %02iSeconds\
                            \nDatetime = %s"
,
                            
timeleft 3600 24timeleft 60 60timeleft 60,
                            
buffer);

    return 
Plugin_Continue;
}


public 
Action MyTimer(Handle timer)
{

    
int timeleft timestamp GetTime();
    
//PrintToServer("seconds %i", timeleft);

    
switch(timeleft)
    {
        case 
900:
        {
            
PrintToChatAll("[SM] Server restart in %i minutes"timeleft 60);
        }

        case 
600:
        {
            
PrintToChatAll("[SM] Server restart in %i minutes"timeleft 60);
        }
        case 
10:
        {
            
PrintToChatAll("[SM] Server restart in %i seconds"timeleft);
        }
        case 
5,4,3,2,1:
        {
            
PrintToChatAll("%i"timeleft);
        }
        case 
0:
        {
            
PrintToChatAll("[SM] Server restart Now!");
        }
    }

    if(
timeleft <= 0)
    {
        
Start();


        for(
int i 1<= MaxClientsi++)
        {
            if(!
IsClientInGame(i) || IsFakeClient(i)) continue;
            
            
ReconnectClient(i);
        }

        return 
Plugin_Stop
    
}

    return 
Plugin_Continue;

Can someone fix this for SM 1.11? Ty

L 06/30/2022 - 16:59:06: [SM] Exception reported: Current result set has no fetched rows
L 06/30/2022 - 16:59:06: [SM] Blaming: restart.smx
L 06/30/2022 - 16:59:06: [SM] Call stack trace:
L 06/30/2022 - 16:59:06: [SM] [0] SQL_FetchInt
L 06/30/2022 - 16:59:06: [SM] [1] Line 22, restartann.sp::Start
L 06/30/2022 - 16:59:06: [SM] [2] Line 11, restartann.sp::OnPluginStart
Caaine is offline
Caaine
Member
Join Date: Oct 2013
Old 07-03-2022 , 13:30   Re: Server Restart Modification / Help Requests/ can Authors help?
Reply With Quote #25

Quote:
Originally Posted by Marttt View Post
Probably not SM1.11 related, you just don't have the database
The error message came with 1.11 with 1.10 it's working fine

Last edited by Caaine; 07-03-2022 at 13:33.
Caaine is offline
freak.exe_uLow
AlliedModders Donor
Join Date: Jul 2012
Location: Germany
Old 01-15-2023 , 12:40   Re: Server Restart Modification / Help Requests/ can Authors help?
Reply With Quote #26

Thanks goes to @Bara (Fixed SM 1.11 issue)
Attached Files
File Type: sp Get Plugin or Get Source (restart-message.sp - 61 views - 2.5 KB)
freak.exe_uLow 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 21:06.


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