This has also a loop in Mirc that check the socket is open all the time so you don't have to do manually anything there.
auxsvc.cfg
Code: Select all
AuxService
{
Port 5005
Script MircListener
}
"Change the include "Include/Modules"; to use whatever em is needed, sorry Im too lazy to check because I use that include for all my scripts.
Code: Select all
include "Include/Modules";
program MircListener( connection )
SetGlobalProperty( "AuxConnection", GetPid() );
var ev;
while ( connection )
if ( connection.ip != "127.0.0.1" )
continue;
else
Print( connection.ip );
ev := wait_for_event( 5 );
endif
if ( ev )
if ( ev.value == "Restart" )
connection.transmit( "Restart " + CInt( ev.timer ) );
else
continue;
endif
endif
Sleep( 1 );
endwhile
return 1;
endprogram
Code: Select all
include "Include/Modules";
program Command_restart( character, text )
var script := GetProcess( CInt( GetGlobalProperty( "AuxConnection" ) ) );
var data := struct;
data.+type := "recv";
data.+value := "Restart";
data.+timer := Cint( text );
Print( data );
script.sendevent( data );
Start_Script( ":Commands:Control/Restart", array{ CInt( text ) } );
endprogram
Code: Select all
include "Include/Modules";
program Control_Restart( param )
var time := CInt( param +1 );
Print( "Restart countdown started." );
if ( time > 61 )
time := 61;
endif
if ( time < 1 )
time := 1;
endif
for( time; time >= 0; time -= 1 )
if ( time > 0 )
Print( "System Message: " + CStr( CInt( time ) ) + " minute(s) to restart!" );
BroadCast( "[System]: " + CStr( CInt( time ) ) + " minute(s) to restart!" );
endif
Sleep( 60 );
endfor
Shutdown();
endprogram
In Remote.ini
Code: Select all
on *:START: {
sockopen Pol 127.0.0.1 5005
sockettimer
}
on *:SOCKREAD:Pol: {
:n
sockread %RestartTime
if $sockbr == 0 {
halt
}
%RestartTime = $remove( %RestartTime, sRestart )
%SleepTime = $calc( ( %RestartTime * 60 ) + 120 )
timer 1 %SleepTime /startpol
goto n
halt
}
Code: Select all
/sockettimer /timer 0 10 /socketcheck
/socketcheck if $sock( Pol, 1 ) != Pol { sockopen Pol 127.0.0.1 5005 }
/startpol /run -p "Pol Directory\pol.exe"