Soul Posted August 5, 2014 Report Share Posted August 5, 2014 Force update money on disconnect: Potential for decreasing amount of communication gameserver <-> hive <-> database in: variables.sqf Find: if(isNil "DZE_maintainRange") then { DZE_maintainRange = ((DZE_PlotPole select 0)+35); }; Add below: if(isNil "DZE_fUpdateMoney") then { DZE_fUpdateMoney = false; }; Note: you can set it here to true or use the variable in init.sqf In: server_onPlayerDisconnect.sqf Find: [_playerObj,_magazines,true,true,_isplayernearby] call server_playerSync; Replace with: [_playerObj,_magazines,true,true,_isplayernearby,DZE_fUpdateMoney] call server_playerSync; in: server_playerSync.sqf Find: if( isNil "_headShotsZupa") then{ _headShotsZupa = 0; }; Add below: _fUpdateMoney = false; if ((count _this) > 5) then { _fUpdateMoney = _this select 5; }; Find: if(_isChanged > 0)then{ _key = format["CHILD:999:UPDATE `character_data` SET `HeadshotsZ` = %1 WHERE `CharacterID` = %2:[0]:",_headShotsZupa,_characterID]; _result = _key call server_hiveReadWrite; _character setVariable ["moneychanged",0,true]; }; Replace with: if((_isChanged > 0) || _fUpdateMoney)then{ _key = format["CHILD:999:UPDATE `character_data` SET `HeadshotsZ` = %1 WHERE `CharacterID` = %2:[0]:",_headShotsZupa,_characterID]; _result = _key call server_hiveReadWrite; _character setVariable ["moneychanged",0,true]; }; Storm 1 Link to comment Share on other sites More sharing options...
Storm Posted August 5, 2014 Report Share Posted August 5, 2014 Force update money on disconnect: Potential for decreasing amount of communication gameserver <-> hive <-> database in: variables.sqf Find: if(isNil "DZE_maintainRange") then { DZE_maintainRange = ((DZE_PlotPole select 0)+35); }; Add below: if(isNil "DZE_fUpdateMoney") then { DZE_fUpdateMoney = false; }; Note: you can set it here to true or use the variable in init.sqf In: server_onPlayerDisconnect.sqf Find: [_playerObj,_magazines,true,true,_isplayernearby] call server_playerSync; Replace with: [_playerObj,_magazines,true,true,_isplayernearby,DZE_fUpdateMoney] call server_playerSync; in: server_playerSync.sqf Find: if( isNil "_headShotsZupa") then{ _headShotsZupa = 0; }; Add below: _fUpdateMoney = false; if ((count _this) > 5) then { _fUpdateMoney = _this select 5; }; Find: if(_isChanged > 0)then{ _key = format["CHILD:999:UPDATE `character_data` SET `HeadshotsZ` = %1 WHERE `CharacterID` = %2:[0]:",_headShotsZupa,_characterID]; _result = _key call server_hiveReadWrite; _character setVariable ["moneychanged",0,true]; }; Replace with: if((_isChanged > 0) || _fUpdateMoney)then{ _key = format["CHILD:999:UPDATE `character_data` SET `HeadshotsZ` = %1 WHERE `CharacterID` = %2:[0]:",_headShotsZupa,_characterID]; _result = _key call server_hiveReadWrite; _character setVariable ["moneychanged",0,true]; }; Good job. I believe this would also fix a lot of duping problems as well. Link to comment Share on other sites More sharing options...
Zupa Posted August 6, 2014 Report Share Posted August 6, 2014 Great idea, only problem i see whit this (if you are going to make that an && and only save on disconnect) is that when server restarts with players still on it, their cast will not get saved, cus server is not running anymore. This could be solved maybe with a force disconnect script ofcoruse that handles like 30secs before the actual restart. 31_D!4b10 1 Link to comment Share on other sites More sharing options...
Storm Posted August 7, 2014 Report Share Posted August 7, 2014 Great idea, only problem i see whit this (if you are going to make that an && and only save on disconnect) is that when server restarts with players still on it, their cast will not get saved, cus server is not running anymore. This could be solved maybe with a force disconnect script ofcoruse that handles like 30secs before the actual restart. Simple way to fix that would be have a acript that will save it based on the time the user puts. (e.g server restarts every 3 hours have the server save it at 2 hours and 59 minutes) Link to comment Share on other sites More sharing options...
Soul Posted August 8, 2014 Author Report Share Posted August 8, 2014 you could use server uptime but if the server was restarted manually that would cause problems. or we could use the hive's getDateTime module to get system time and work of that. wich should be far more reliable. Link to comment Share on other sites More sharing options...
Gr8 Posted August 9, 2014 Report Share Posted August 9, 2014 with this, when you give players coins, they disappear after restart, any fix? Link to comment Share on other sites More sharing options...
McPimpin Posted August 17, 2014 Report Share Posted August 17, 2014 Soul, with your Hive.DLL How does one make a forceupdate? Link to comment Share on other sites More sharing options...
Soul Posted August 17, 2014 Author Report Share Posted August 17, 2014 This code is actually not needed, as i see it now it should by default force the playersync when someone disconnects... Link to comment Share on other sites More sharing options...
JohnnyBravo666 Posted October 8, 2014 Report Share Posted October 8, 2014 Ok I've followed every step here and I still cannot get my coin to save to the player. Nothing shows up for errors in the RPT file. I really am at a loss here for trying to get this currency to work. I've re-installed the DLL files many times, this page here I thought for sure was going to help, but still nothing. Can someone please help me. Everything else for the currency works fine. If I buy other currency such as gold bars or briefcases or whatever, it all saves upon a disconnect. It's just that if I have any coin on me or in bank, it won't save it. Link to comment Share on other sites More sharing options...
NovusB Posted January 21, 2015 Report Share Posted January 21, 2015 So as you stated soul, this script isn't needed because playersync automatically updates on DC? Can you confirm? Link to comment Share on other sites More sharing options...
Gr8 Posted January 26, 2015 Report Share Posted January 26, 2015 So as you stated soul, this script isn't needed because playersync automatically updates on DC? Can you confirm? Yes, You dont need this anymore with the latest script Link to comment Share on other sites More sharing options...
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now