Is there a way to run a script (whether it be JavaScript or BeamEngine) when the game is about to close via "X" or the quit button? I've tried onClientEndMission, but it doesn't seem to work when closing the game like that. Thanks, StinchinStein
I see what you mean. Here are all the hooks called after you click the "X" to close the game. updateGFX onVehicleDestroyed onDespawnObject onDebugDraw onSettingsChanged The way I determined this was by modifying extensions.lua - please see the attached screenshot for what I did. I'd say that none of the hooks called after clicking the "X" do what you are asking for precisely. Depending on what you want to do it might be practical to use one of them anyway. For example if you're trying to save the state of something lightweight you could simply do it every time onDespawnObject is called.
Thanks for the response @torsion, I completely forgot about this until you replied to it. I'll definitely see if I can do something with this information
I hope it helps! I'm sure you realize this, but just to be absolutely clear for anyone else trying to use the information I posted: Some of those hooks are called for many other things. None of them directly have anything to do with the game being closed. For example, updateGFX and onDebugDraw are definitely called constantly in the normal course of the game.