Arconymos 0 Posted March 6, 2019 Hello, i am currently working on a small mission with a persistent map. The players and vehicles are saved into a mysql database. Everytime i saving a player, there is a short moment of stuttering of the game (around 0,5sec). It is very annoying if i save each player every 5 seconds. Now i asking myself if there are events that i can register my save function to. I've tried the OnPlayerDisconnect and HandleDisconnect events -> None of them works. My save function needs the player object as a parameter. Is there someone who can give me an advice? Thanks. Share this post Link to post Share on other sites
7erra 629 Posted March 6, 2019 At the start of the mission you could load the database from mysql into the missionNamespace (or similar) and use the default arma commands to edit and save variables during the mission. When the mission ends or the server restart you can now save the variables in the mysql database. Should be way more efficient since it is not a file operation each time. Share this post Link to post Share on other sites
xjoker_ 25 Posted March 7, 2019 If you only need the player object and not his local variables, HandleDisconnect works great (it has to be executed on the server) I'm using it in my mission. 21 hours ago, 7erra said: At the start of the mission you could load the database from mysql into the missionNamespace (or similar) and use the default arma commands to edit and save variables during the mission. When the mission ends or the server restart you can now save the variables in the mysql database. Should be way more efficient since it is not a file operation each time. That's a solution but if the server crash for whatever reason, nothing will be saved Share this post Link to post Share on other sites
killzone_kid 1332 Posted March 7, 2019 On 3/6/2019 at 4:17 PM, Arconymos said: None of them works Elaborate Share this post Link to post Share on other sites
DeathF0X 198 Posted March 8, 2019 On 3/6/2019 at 5:17 PM, Arconymos said: Hello, i am currently working on a small mission with a persistent map. The players and vehicles are saved into a mysql database. Everytime i saving a player, there is a short moment of stuttering of the game (around 0,5sec). It is very annoying if i save each player every 5 seconds. Now i asking myself if there are events that i can register my save function to. I've tried the OnPlayerDisconnect and HandleDisconnect events -> None of them works. My save function needs the player object as a parameter. Is there someone who can give me an advice? Thanks. initServer.sqf //example addMissionEventHandler ["HandleDisconnect", { params ["_unit", "_id", "_uid", "_name"]; _gear = getUnitLoadout _unit; [_unit,_gear] remoteExec ["fox_alive_fnc_savePlayer",2]; format["%1 left the server.",_name] remoteExec ["systemChat",-2]; }]; Share this post Link to post Share on other sites
xjoker_ 25 Posted March 8, 2019 2 hours ago, DeathF0X said: initServer.sqf //example addMissionEventHandler ["HandleDisconnect", { params ["_unit", "_id", "_uid", "_name"]; _gear = getUnitLoadout _unit; [_unit,_gear] remoteExec ["fox_alive_fnc_savePlayer",2]; format["%1 left the server.",_name] remoteExec ["systemChat",-2]; }]; You don't need to remoteExec to the server if you already are on the server Share this post Link to post Share on other sites
gc8 981 Posted March 11, 2019 Is it ok to ask here, where could you save if you are saving the whole mission but not players? Share this post Link to post Share on other sites