Standardize coin variables, prevent coins not refreshing on skin change. (#1904)

* Standardize coin variables, prevent coins not refreshing on skin change.

* Add missing commit
This commit is contained in:
oiad
2017-03-12 07:05:34 +13:00
committed by ebayShopper
parent 6871da6168
commit 2ec5390b70
4 changed files with 22 additions and 10 deletions

View File

@@ -1,4 +1,4 @@
private ["_charID","_newmodel","_old","_updates","_humanity","_medical","_worldspace","_zombieKills","_headShots","_humanKills","_combattimeout","_inCombat","_banditKills","_fractures","_wpnType","_ismelee","_coins"];
private ["_charID","_newmodel","_old","_updates","_humanity","_medical","_worldspace","_zombieKills","_headShots","_humanKills","_combattimeout","_inCombat","_banditKills","_fractures","_wpnType","_ismelee","_coins","_bankCoins","_globalCoins"];
//_playerUID = _this select 0;
_charID = _this select 1;
_model = _this select 2;
@@ -29,7 +29,12 @@ _ConfirmedHumanKills = player getVariable ["ConfirmedHumanKills",0];
_ConfirmedBanditKills = player getVariable ["ConfirmedBanditKills",0];
_friendlies = player getVariable ["friendlies",[]];
_tagSetting = player getVariable ["DZE_display_name",false];
if (Z_SingleCurrency) then {_coins = player getVariable [Z_moneyVariable,0];};
if (Z_SingleCurrency) then {
_coins = player getVariable [Z_moneyVariable,0];
_bankCoins = player getVariable [Z_bankVariable,0];
_globalCoins = player getVariable [Z_globalVariable,0];
};
//Switch
_model call player_switchModel; //Already spawned thread, no need to spawn and waitUntil script is done
@@ -90,7 +95,12 @@ player setVariable ["ConfirmedHumanKills",_ConfirmedHumanKills,true];
player setVariable ["ConfirmedBanditKills",_ConfirmedBanditKills,true];
player setVariable ["friendlies",_friendlies,true];
player setVariable ["DZE_display_name",_tagSetting,true];
if (Z_SingleCurrency) then {player setVariable [Z_moneyVariable,_coins,true];};
if (Z_SingleCurrency) then {
player setVariable [Z_moneyVariable,_coins,true];
player setVariable [Z_bankVariable,_bankCoins,true];
player setVariable [Z_globalVariable,_globalCoins,true];
};
//PVDZ_serverStoreVar = [player,"Achievements",_achievements];
//publicVariableServer "PVDZ_serverStoreVar";

View File

@@ -68,7 +68,9 @@ Z_AllowTakingMoneyFromBackpack = true; // Allow traders to take money from backp
Z_AllowTakingMoneyFromVehicle = true; // Allow traders to take money from vehicles when buying with default currency.
Z_SingleCurrency = false; // Does your server use a single currency system?
CurrencyName = "Coins"; // If using single currency this is the currency display name.
Z_MoneyVariable = "cashMoney"; // If using single currency this is the variable name used to store player wealth.
Z_moneyVariable = "cashMoney"; // If using single currency this is the variable name used to store player wealth.
Z_bankVariable = "moneySpecial"; // If using single currency this is the variable name used to store object bank wealth.
Z_globalVariable = "GlobalMoney"; // If using single currency this is the variable name used to store coins globally.
DZE_MoneyStorageClasses = []; // If using single currency this is an array of object classes players can store coins in.
// Plot Management and Plot for Life

View File

@@ -488,7 +488,7 @@ class FSM
"_isInfected = false;" \n
"_characterCoins = 0;" \n
"_globalCoins = 0;" \n
"_CoinsSpecial = 0;" \n
"_bankCoins = 0;" \n
"" \n
"if (count _msg > 7) then {" \n
" _isHiveOk = _msg select 7;" \n
@@ -496,7 +496,7 @@ class FSM
" _isInfected = _msg select 9;" \n
" _characterCoins = _msg select 11;" \n
" _globalCoins = _msg select 12;" \n
" _CoinsSpecial = _msg select 13;" \n
" _bankCoins = _msg select 13;" \n
" diag_log (""PLAYER RESULT: "" + str(_isHiveOk));" \n
"};" \n
"" \n
@@ -1159,8 +1159,8 @@ class FSM
"" \n
"if (Z_SingleCurrency) then {" \n
" player setVariable [Z_MoneyVariable, _characterCoins, true];" \n
" player setVariable [""GlobalMoney"", _globalCoins, true];" \n
" player setVariable [""MoneySpecial"", _CoinsSpecial, true];" \n
" player setVariable [Z_globalVariable, _globalCoins, true];" \n
" player setVariable [Z_BankVariable, _bankCoins, true];" \n
"};" \n
"dayz_musicH = [] spawn player_music;" \n
"dayz_slowCheck = [] spawn player_spawn_2;" \n

View File

@@ -36,8 +36,8 @@ _medical = [];
_distanceFoot = 0;
//all getVariable immediately
_globalCoins = _character getVariable ["GlobalMoney", -1];
_bankCoins = _character getVariable ["MoneySpecial", -1];
_globalCoins = _character getVariable [Z_globalVariable, -1];
_bankCoins = _character getVariable [Z_BankVariable, -1];
_coins = _character getVariable [Z_MoneyVariable, -1]; //should getting coins fail set the variable to an invalid value to prevent overwritting the in the DB
_lastPos = _character getVariable ["lastPos",_charPos];
_usec_Dead = _character getVariable ["USEC_isDead",false];