splewis / csgo-practice-mode

CS:GO Sourcemod plugin for private team/individual practice servers
GNU General Public License v3.0
455 stars 70 forks source link

sm_practicemode_autostart 1 triggers on round start (not just map start) #219

Closed Lidbetter closed 2 years ago

Lidbetter commented 2 years ago

Expected behavior

When using sm_practicemode_autostart 1 I expect:

Actual behavior

When using sm_practicemode_autostart 1 I experience:

Steps to reproduce

Practice mode is also re-enabled on round restart even if sm_practicemode_can_be_started 0

For now I have worked around this issue (because it is nice to have the server start in prac mode) by adding the following lines to the cfg files which get5 executes when starting a scrim

sm_practicemode_autostart 0
sm_exitpractice
Lidbetter commented 2 years ago

So looks like this is intentional: https://github.com/splewis/csgo-practice-mode/blob/afab77b039b05199e869dcb438c4a191de9f83d1/scripting/practicemode.sp#L855-L863

https://github.com/splewis/csgo-practice-mode/blob/afab77b039b05199e869dcb438c4a191de9f83d1/scripting/practicemode.sp#L747-L768

Without introducing anymore state, perhaps one way we could address this is to set g_AutostartCvar.IntValue 0 when disabling prac mode (and re-reading from cfg file when (re)enabled (via ingame menu or command))

splewis commented 2 years ago

I would agree the current behavior is a little strange in the way you describe. IMO, once practicemode is turned off by players on a server, it shouldn't be restarted without a map change.

I think I would prefer doing that without actually having to modify the g_AutostartCvar value.