reconnect after server restart
#1

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.
Reply
#2

Use /rcon gmx then crash the server
Reply
#3

lol why all that code.

try Keeping the server online
Reply
#4

Quote:
Originally Posted by Spmn
Посмотреть сообщение
Use /rcon gmx then crash the server
How to crash it? Some code please?

Quote:
Originally Posted by iLearner
Посмотреть сообщение
lol why all that code.

try Keeping the server online
I need it for Windows.
Reply
#5

Код:
RestartServer()
{
    SendRconCommand("gmx");
    #emit sysreq.c 0xFFFFFFFF
}
Reply
#6

Open an invalid file.


e.g:
PHP код:
new File:myFile fopen("MyNonExistentFile.txt"io_read);
new 
buf[10];
while(
fread(myFilebuf)) print(buf); 
This will crash ur server.(don't create "MyNonExistentFile.tet" file)
Reply
#7

thanks both, works perfectly
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)