reconnect after server restart - Printable Version
+- SA-MP Forums Archive (
https://sampforum.blast.hk)
+-- Forum: SA-MP Server (
https://sampforum.blast.hk/forumdisplay.php?fid=6)
+--- Forum: Server Support (
https://sampforum.blast.hk/forumdisplay.php?fid=19)
+--- Thread: reconnect after server restart (
/showthread.php?tid=640368)
reconnect after server restart -
wallee - 01.09.2017
I want to be able to reconnect to the server (after i close and restart it) without having to re-launch the game.
I tried this:
Код:
@ECHO OFF
TITLE Yom's SA-MP server restarter
COLOR 09
SET option_log=0
SET folder=restarter
SET file_1=server_log.txt
SET file_2=%folder%\server.log
SET file_3=%folder%\restarter.log
SET file_4=%folder%\reset.reg
SET server=samp-server.exe
SET count=0
SET regkey="HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\AeDebug"
IF NOT EXIST %server% (
COLOR 0C
ECHO %server% was not found!
ECHO Press any key to exit.
PAUSE > NUL
GOTO EOF
)
IF NOT EXIST %folder% MD %folder%
IF NOT EXIST %file_4% (
REG EXPORT %regkey% %file_4% > NUL
REG ADD %regkey% /V Auto /D 1 /F > NUL
REG ADD %regkey% /V Debugger /D 0 /F > NUL
)
:START
CLS & ECHO.
SET hh=%time:~0,2%
IF %hh% LSS 10 SET hh=0%time:~1,1%
SET msg=[%date%][%hh%:%time:~3,5%] Server
IF %count% EQU 0 (SET msg=%msg% started.) ELSE SET msg=%msg% restarted [%count%x].
ECHO %msg% & ECHO %msg%>> %file_3%
IF %option_log% EQU 1 (
ECHO %msg%>> %file_2%
TYPE %file_1%>> %file_2%
FOR /L %%i IN (1,1,4) DO ECHO.>> %file_2%
)
GOTO NEXT
:NEXT
SET /A count+=1
CALL %server%
GOTO START
:EOF
After i used "/rcon exit" i get "server closed the connection" ... the server itself did restart but to actually play on it i would have to re-launch the game.
So am i missing something? I remember this (or something similar) working.
Re: reconnect after server restart -
Spmn - 01.09.2017
Use /rcon gmx then crash the server
Re: reconnect after server restart -
iLearner - 01.09.2017
lol why all that code.
try
Keeping the server online
Re: reconnect after server restart -
wallee - 01.09.2017
Quote:
Originally Posted by Spmn
Use /rcon gmx then crash the server
|
How to crash it? Some code please?
Quote:
Originally Posted by iLearner
|
I need it for Windows.
Re: reconnect after server restart -
Spmn - 01.09.2017
Код:
RestartServer()
{
SendRconCommand("gmx");
#emit sysreq.c 0xFFFFFFFF
}
Re: reconnect after server restart -
iLearner - 01.09.2017
Open an invalid file.
e.g:
PHP код:
new File:myFile = fopen("MyNonExistentFile.txt", io_read);
new buf[10];
while(fread(myFile, buf)) print(buf);
This will crash ur server.(don't create "MyNonExistentFile.tet" file)
Re: reconnect after server restart -
wallee - 01.09.2017
thanks both, works perfectly