T5 GSC script command listener stops listening after dying in zombies (sometimes)
BO1 Modding Support & Discussion
1
Posts
1
Posters
16
Views
1
Watching
-
So I use this format in pretty much all of my GSC scripts to listen to commands.
Below is an example for my easteregg song script.init() { if (GetDvar("mapname") == "frontend") return; level thread jf_ee_on_connect(); } jf_ee_on_connect() { level endon("game_ended"); for (;;) { level waittill("connected", player); player thread jf_ee_listener(); } } jf_ee_listener() { self endon("disconnect"); level endon("game_ended"); self notifyOnPlayerCommand("jf_easteregg_cmd", "jf_easteregg"); for (;;) { self waittill("jf_easteregg_cmd"); self iPrintlnBold("^5Playing Easter Egg song..."); self thread jf_play_easteregg_song(); } }
And I am trying to work out why exactly it will work perfectly fine, but after dying and clicking "restart level", I will get hit with
"Unknown command: jf_easteregg" when I try it again...The fix is just to click restart again.. and it fixes..
To make matters worse, i can't even replicate the bug consistently. It doesn't happen every time you go down and click restart, but it has never happened mid game and is always during that edge case.
What am i doing wrong?