Page 1 of 1

OnLevelShutdown and OnLevelInit

Posted: Fri Jul 08, 2016 7:31 pm
by decompile
Hey, Is it just me or is OnLevelShutdown after OnLevelInit?

Im currently writing my own demo system,

but when I execute tv_record 'auto-20160708-211956-surf_ori_l' in OnLevelInit and tv_stoprecord in OnLevelShutdown, im getting

Code: Select all

Recording SourceTV demo to ./auto-20160708-211956-surf_ori_l.dem...
Executing dedicated server config file server.cfg
Set motd from file 'cfg/motd.txt'
Set motd_text from file 'cfg/motd_text.txt'
[SourceBans] Loading configs/sourcebans.cfg config file
[SourceComms] Loading configs/sourcebans/sourcebans.cfg config file
[SourceComms] Loading configs/sourcecomms.cfg config file
Completed SourceTV demo "./auto-20160708-211956-surf_ori_l.dem", recording time 0.0


So the demo files end with 0.0

Is it just a bug or how can I fix that?

Re: OnLevelShutdown and OnLevelInit

Posted: Sat Jul 09, 2016 1:02 am
by L'In20Cible

Re: OnLevelShutdown and OnLevelInit

Posted: Sat Jul 09, 2016 1:42 am
by L'In20Cible
I went ahead and added a OnMapEnd listener which will never gets called more than once per map change.

Re: OnLevelShutdown and OnLevelInit

Posted: Sat Jul 09, 2016 9:06 am
by iPlayer
I might get it wrong, but does OnLevelShutdown fire at the same time with cs_win_panel_match event in CS:S/CS:GO?

Re: OnLevelShutdown and OnLevelInit

Posted: Sat Jul 09, 2016 9:37 am
by L'In20Cible
iPlayer wrote:I might get it wrong, but does OnLevelShutdown fire at the same time with cs_win_panel_match event in CS:S/CS:GO?

No. That event is fired when the final scoreboard is sent to clients while that listener is called when it close (before Host_Changelevel gets called). And sometime is called again right before OnLevelInit into the map change process. The OnMapEnd listener makes sure it only get called before Host_Changelevel (by using a guard variable defined to True when a map has been initialized and False as soon as it got called once).