MantisBT - Zandronum
View Issue Details
0003723Zandronum[All Projects] Bugpublic2019-10-14 21:352019-10-15 02:02
StrikerMan780 
 
normalmajoralways
newopen 
MicrosoftWindowsXP/Vista/7
3.0 
 
0003723: DISCONNECT scripts don't execute for last player to leave server.
If there's only one player in a server, and they leave, the server will not execute any DISCONNECT scripts for them.

This is quite an issue, especially for mods that use DISCONNECT to do cleanup for clients leaving the game (such as the arcade machines in SMMP, which uses the DISCONNECT scripts to prevent them from being stuck in a bad state when someone leaves), or for things such as saving Database stats for players that leave the game (XP, Money, etc).
Make a script called DCDEBUG.ACS, with these contents, and use LOADACS to load it.

Start a server with it, and make one client join it. Enter the game and disconnect that client. You will find in the server's log, the print doesn't even execute. Next, connect two clients, and have one of them leave. You'll find that the print will execute when there's at least one other player.

#library "DCDEBUG"
#include "zcommon.acs"

script "LOGOFF" (int pnum) DISCONNECT
{
    printbold(s:"[DEBUG] Disconnected (Player #", d:pnum, s:")");
}
No tags attached.
Issue History
2019-10-14 21:35StrikerMan780New Issue
2019-10-14 22:08AOSPNote Added: 0021072
2019-10-14 22:09AOSPNote Edited: 0021072bug_revision_view_page.php?bugnote_id=21072#r12883
2019-10-15 02:02StrikerMan780Note Added: 0021073

Notes
(0021072)
AOSP   
2019-10-14 22:08   
(edited on: 2019-10-14 22:09)
This is intended behaviour, the gamesim stops when there are no clients connected in the server.

Connect another client, and the DISCONNECT script will immediately run.

(0021073)
StrikerMan780   
2019-10-15 02:02   
Shit, how did I not notice that before? Oh well, alright. Thanks.