rwake345 10 Posted March 8, 2013 Hey everyone, I am making a mission and am trying to add a money system. At this moment we have stuff working, but we do not know how to save the amount of money, at this moment you just get $100 on login. Would you save it to a MySQL database? If so how do you do that? I am unsure of what to save the amount of money to, so if anyone could help that would be great. Share this post Link to post Share on other sites
dga 12 Posted March 8, 2013 (edited) You could store the stuff into an array for example http://community.bistudio.com/wiki/Array But it will be gone when the mission/server restarts. To have it persistent, is quite complicated. Only clues I can give... in ArmA2 there was a command to write values to the clipboard. You would then need to code an small app, that monitors the clipboard and writes the values to the database. This should also work the other way around. But it's not very simple ^^ Edited March 8, 2013 by dga Share this post Link to post Share on other sites
loyalguard 15 Posted March 8, 2013 (edited) I have never used these commands, but profileNamespace and saveprofileNamespace might be able to accomplish what you are looking for. These were initially implemented in TOH, then later in A2OA, and should also be in A3. What they do is save a variable to your profile that would persist after you log off and then reload when you log back on. This thread can give you an idea of how it works (it is from TOH but should still be applicable): http://forums.bistudio.com/showthread.php?122995-profileNamespace-how-to-use Here is an example of how it might work: // Give the player $100 and save that amount in a variable called "money" in the player's profile name space. profileNamespace setVariable ["money", 100]; // Save all the variables in the player's profile to a file in case the player disconnects.logs off. saveprofileNamespace; //Find out how much money the player has. _currentMoney = profileNamespace getVariable "money"; // Should return 100. //Give the player $10 more dollars. _currentMoney = _currentMoney + 10; profileNamespace setVariable ["money", _currentMoney]; // Save all the variables in the player's profile (again) to a file in case the player disconnects. saveprofileNamespace; Make sure you see the warnings about usting saveprofileNamespace too often as it uses a lot of resources. Edited March 8, 2013 by Loyalguard Expanded example Share this post Link to post Share on other sites
dcthehole 1 Posted March 9, 2013 Would this work in ArmA 3? Cause this is a take on helicopters command is it now also an arma 3 command? Share this post Link to post Share on other sites
loyalguard 15 Posted March 9, 2013 Those commands are listed in the post 1.62 beta builds and are listed among the available A3 commands: https://dev-heaven.net/projects/cmb/repository/revisions/745d0efc55f45da299f167b03ca16d4422aacb99/entry/scripts/A3/diffs/supportInfo.sqf So they should work in A3 Share this post Link to post Share on other sites
seannybgoode 10 Posted March 9, 2013 wait for java if you want to save data across server restarts.. writing binary files is easssssssssyyyyyyyy Share this post Link to post Share on other sites