]> git.xonotic.org Git - xonotic/xonotic-data.pk3dir.git/blobdiff - qcsrc/server/client.qc
Call a hook when the server player count changes to or from zero
[xonotic/xonotic-data.pk3dir.git] / qcsrc / server / client.qc
index a5f508851b00876304e486f92f9fcb9634d6f438..2c3bdc25ccf07e90931e1c0704cd09c44a0ffc71 100644 (file)
@@ -1194,6 +1194,9 @@ void ClientConnect(entity this)
 
        MUTATOR_CALLHOOK(ClientConnect, this);
 
+       if (player_count == 1)
+               localcmd("\nsv_hook_firstjoin\n");
+
        if (IS_REAL_CLIENT(this) && !IS_PLAYER(this) && !autocvar_g_campaign)
                CS(this).motd_actived_time = -1; // the welcome message is shown by the client
 }
@@ -1262,6 +1265,9 @@ void ClientDisconnect(entity this)
        player_powerups_remove_all(this); // stop powerup sound
 
        ONREMOVE(this);
+
+       if (player_count == 0)
+               localcmd("\nsv_hook_lastleave\n");
 }
 
 void ChatBubbleThink(entity this)