7erra 629 Posted September 3, 2018 Hi everyone, I was wondering if there was a command to detect whether the mission has ended by aborting it? the mission eventhandler only fires on the following cases: Quote Triggered when mission ends, either using trigger of type "End", endMission command, BIS_fnc_endMission function or ENDMISSION cheat. HandleDisconnect is one of the MEHs I'm currently using for saving the loadouts of the players (with inidbi2) but when there is someone hosting the server his loadout won't be saved as he is not "disconnecting". This will also be useful in case the dedicated server will get shutdown as I'm planning to add more variables to the mission which need to be saved too. My current workaround would be to use addAction to manually save the progress or a loop, which wouldn't be very performance friendly I think. Thanks in advance, 7erra Share this post Link to post Share on other sites
Grumpy Old Man 3548 Posted September 3, 2018 17 minutes ago, 7erra said: Hi everyone, I was wondering if there was a command to detect whether the mission has ended by aborting it? the mission eventhandler only fires on the following cases: HandleDisconnect is one of the MEHs I'm currently using for saving the loadouts of the players (with inidbi2) but when there is someone hosting the server his loadout won't be saved as he is not "disconnecting". This will also be useful in case the dedicated server will get shutdown as I'm planning to add more variables to the mission which need to be saved too. My current workaround would be to use addAction to manually save the progress or a loop, which wouldn't be very performance friendly I think. Thanks in advance, 7erra Try getClientState, works on dedicated as well. Cheers 2 Share this post Link to post Share on other sites
7erra 629 Posted September 3, 2018 Is there maybe an eventhandler? getClientState will require to check every so and so seconds. If the variable changes in the time between the last iteration and log out it wont be saved. Share this post Link to post Share on other sites
pierremgi 4906 Posted September 3, 2018 Your problem seems to be for the player hosting the server (other ones can fire MEH handle disconnect). So, I suggest you to wait for an escape key event (in hosted server) and save the player's loadout at this step. If (isServer && !isDedicated) then { waitUntil (!isnull findDisplay 46); findDisplay 46 displayAddEventHandler [ "KeyDown", { params[ "_display", "_keyCode" ]; if ( _keyCode in actionKeys "ingamePause" ) then { // save player's loadout here (and all others players' stuffs by the way }; }]; }; 4 Share this post Link to post Share on other sites
Grumpy Old Man 3548 Posted September 4, 2018 Like @pierremgi stated, waiting for an escape keydown event might be the most fitting solution. Alternatively you could make it so players can only save gear at specific locations/objects, though that might not be suited depending on mission type. Cheers Share this post Link to post Share on other sites
gc8 981 Posted September 4, 2018 Not sure if this helps but "PlayerDisconnected" EH triggers for the server too on dedicated at least. addMissionEventHandler ["PlayerDisconnected", { _pro = _this select 2; if(_pro == "__SERVER__") then { // Server quitting }; }; 3 Share this post Link to post Share on other sites
7erra 629 Posted September 4, 2018 14 hours ago, pierremgi said: for the player hosting the server Exactly. The KeyDown EH seems really good. I was was thinking about using a waitUntil loop to detect opening of the escape menu but the actionKeys command is way better, thank you. 7 hours ago, Grumpy Old Man said: Alternatively you could make it so players can only save gear at specific locations/objects I will use this too as I'm not only going to save loadouts but also vehicles. Those will only be saved if you bring them back in one piece. The loadouts will only be saved when the player logs out while in the base. Saving the loadout on log out will prevent players from duplicating stuff as they can otherwise just save the loadout, give it to another player, log out and receive the same gear again. 3 hours ago, gc8 said: Not sure if this helps but "PlayerDisconnected" EH triggers for the server too on dedicated at least. That is really helpful acutally. I can use this to save som global stats which are handled on the server. Thanks! The concept of the mission is to do smaller ones while operating from a set base. Maybe I'll end the mission each time an objective is completed. This should remove any leftovers from old missions and makes it easier to save the stats to a database. Thanks for the help, all of you have been as helpful as always 7erra 1 Share this post Link to post Share on other sites