wozzsta 16 Posted September 27, 2016 Hi guys, I'm trying to figure out how to save my users money variable so when they connect/disconnect it will remember their cash amount. I don't care about position, health, load-out etc.... just the money variable. Also don't care if it is stored locally or on the server, server is obviously preferable but it doesn't matter really. Any ideas? Thanks, Share this post Link to post Share on other sites
Nikander 122 Posted September 27, 2016 I'm trying to figure out how to save my users money variable so when they connect/disconnect it will remember their cash amount. Hi wozzsta, try this to save the amount of cash profileNamespace setVariable ["cash", _cash] retrieve cash with getVariable like this private _cash = profileNamespace getVariable ["cash", 0] I hope this helps, Nikander Share this post Link to post Share on other sites
davidoss 550 Posted September 27, 2016 Combine profilename with Share this post Link to post Share on other sites
wozzsta 16 Posted September 27, 2016 Hi wozzsta, try this to save the amount of cash profileNamespace setVariable ["cash", _cash] retrieve cash with getVariable like this private _cash = profileNamespace getVariable ["cash", 0] I hope this helps, Nikander Thanks Nikander, Where would i add that code? In the Init.sqf? Share this post Link to post Share on other sites
Nikander 122 Posted September 27, 2016 Where would i add that code? Maybe you should try and add it in the script that you use to handle all the other cash transactions ? Just a suggestion, Nikander Share this post Link to post Share on other sites
Ghost Sniper 1 Posted September 29, 2016 put this in your initPlayerLocal.sqf , its a simple method saving variable using profilenamespace, and check this out https://forums.bistudio.com/topic/141462-inidb-save-and-load-data-to-the-server-or-your-local-computer-without-databases/ private ["_player"]; _player =_this select 0; waitUntil {!isNull _player}; if (isNil {profileNamespace getVariable "char_money"}) then { // if profilenamespace doesn't find your variable it creates as 0 profileNamespace setVariable ["char_money", 0]; }; _profile = (profileNamespace getVariable "char_money"); // Gets your save _player setVariable ["char_money", _profile]; // loads it // make a loop to save your profilenamespace or from a addaction like this. _player addAction ["Save Money",{ _player =_this select 0; _money = (_player getVariable "char_money"); profileNamespace setVariable ["char_money", _money]; }]; 1 Share this post Link to post Share on other sites