+ SV_StopDemoRecording(client); // to split up demos into different files
+ if(sv_autodemo_perclient.integer && client->netconnection)
+ {
+ char demofile[MAX_OSPATH];
+ char levelname[MAX_QPATH];
+ char ipaddress[MAX_QPATH];
+ size_t i;
+
+ // start a new demo file
+ strlcpy(levelname, FS_FileWithoutPath(sv.worldmodel->name), sizeof(levelname));
+ if (strrchr(levelname, '.'))
+ *(strrchr(levelname, '.')) = 0;
+
+ LHNETADDRESS_ToString(&(client->netconnection->peeraddress), ipaddress, sizeof(ipaddress), true);
+ for(i = 0; ipaddress[i]; ++i)
+ if(!isalnum(ipaddress[i]))
+ ipaddress[i] = '-';
+ dpsnprintf (demofile, sizeof(demofile), "%s_%s_%d_%s.dem", Sys_TimeString (sv_autodemo_perclient_nameformat.string), levelname, PRVM_NUM_FOR_EDICT(client->edict), ipaddress);
+
+ SV_StartDemoRecording(client, demofile, -1);
+ }
+