horbin Posted December 19, 2014 Report Share Posted December 19, 2014 I have been having an issue with an HC disconnecting and leaving behind many of its objects on the server, then when reconnecting duplicates get crated, or no cleanup is done and all of the objects are dropped upon the server to manage. Not sure of an easier way (probably is), but to resolve this I have done the following: init.sqf HC_HAL_Objects=[]; HC_HAL_Markers=[]; HC_HAL = false; // set true by HC HC_HAL every 10 seconds. [] spawn { HC_HAL_Connected = false; sleep 60; //Wait for 60secs, if above value not set to true then HC is frozen or disconnected. if (!HC_HAL_Connected) then { // AI taken care of by EPOCH server clean up. // Vehicles (vehicles, buildings, containers) { deleteVehicle _x; diag_log format ["HC_HAL:%1 deleted",_x];} forEach HC_HAL_Vehicles; { _x setMarkerAlpha 0; publiceVariable _x; deleteMarker _x;} forEach HC_HAL_Markers; }; // cut and paste above for additional HC's }; HC_init.sqf //HC to server isAlive loop. [] spawn { // HC_HAL_Objects=[]; add all permanent objects to this, then do publicVariableServer // HC_HAL_Markers=[]; add all markers too. HC_HAL = true; // set true by HC HC_HAL every 10 seconds. publicVariableServer HC_HAL; sleep 10; }; Basically, the server sets the value to false, then waits 60 seconds before testing its value. Every 10 seconds the HC sets the value to true. Concept being if the HC is still connected and alive it will set the value to true before the server tests it. Upon finding 'false' the server cleans up all the objects that where being managed by the HC. Final piece for this to work, is to make sure to add every object (non-ai) that may remain behind to the Objects and Marker variables and update them to the server with 'publicVariableServer'. Just getting into testing it, but if anyone is aware of an easier way to detect an HC disconnect, please let me know :) Link to comment Share on other sites More sharing options...
TheVampire Posted December 19, 2014 Report Share Posted December 19, 2014 Maybe addEventHandler local? When the HC disconnects the objects should be changing locality to the server. You could set it up to delete them when the locality changes. I think the locality of vehicles change to the person that gets in the driver seat though, so this would only apply to scenery and AI units. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now