- 0
trying to get Humanity variable
-
Similar Content
-
- 3 replies
- 1298 views
-
- 5 replies
- 1205 views
-
- 2 replies
- 1325 views
-
- 8 answers
- 1149 views
-
scripting Nexus Community's Arma 2 / DayZ Server is looking for talented people to help us move in the right direction!
By ExclusiveColors,
- staff
- programming
- (and 1 more)
- 0 answers
- 633 views
-
- Advertisement
Question
chargedlight1
https://epochmod.com/forum/topic/43153-released-custom-spawn-loadout-dependend-on-humanity/#comment-285478
-- OLD THREAT -- SOLVED!
Hello guys,
I have a question about spawning my gear on login. I want my default gear dependend on the amount of humanity. i'm currently working in the file: z\dayz_server\compile\server_playerLogin.sqf
But i cant get a reach on how to get that variable in the server. I dont know how to atleast. I've tried alot of variables like:
player getVariable['humanity',0]; which gives me <NULL>
and trying to debug _playerObj and_primary without luck.. server just crashes without any notification.
Here was my line of code to debug that:
diag_log format["object _playerObj: %1",_playerObj];
diag_log format["object _primary: %1",_primary];
does anyone know how to get that humanity variable ? i want to make a switch statement in the if statement here:
if (!_isNew) then { //RETURNING CHARACTER _inventory = _primary select 4; _backpack = _primary select 5; _survival = _primary select 6; _CharacterCoins = _primary select 7; _model = _primary select 8; _group = _primary select 9; _playerCoins = _primary select 10; _BankCoins = _primary select 11; _hiveVer = _primary select 12; if !(_model in AllPlayers) then {_model = "Survivor2_DZ";}; } else { _isInfected = if (DZE_PlayerZed) then {_primary select 3} else {0}; _model = _primary select 4; _group = _primary select 5; _playerCoins = _primary select 6; _BankCoins = _primary select 7; _hiveVer = _primary select 8; if (isNil "_model") then { _model = "Survivor2_DZ"; } else { if (_model == "") then {_model = "Survivor2_DZ";}; }; //Record initial inventory only if not player zombie if (_isInfected != 1) then { _config = configFile >> "CfgSurvival" >> "Inventory" >> "Default"; _mags = getArray (_config >> "magazines"); _wpns = getArray (_config >> "weapons"); _bcpk = getText (_config >> "backpack"); // Switch statement right here if (!isNil "DefaultMagazines") then {_mags = DefaultMagazines;}; if (!isNil "DefaultWeapons") then {_wpns = DefaultWeapons;}; if (!isNil "DefaultBackpack") then {_bcpk = DefaultBackpack;}; //Wait for HIVE to be free _key = format["CHILD:203:%1:%2:%3:",_charID,[_wpns,_mags],[_bcpk,[],[]]]; _key call server_hiveWrite; };
Something like:
if (!_isNew) then { //RETURNING CHARACTER _inventory = _primary select 4; _backpack = _primary select 5; _survival = _primary select 6; _CharacterCoins = _primary select 7; _model = _primary select 8; _group = _primary select 9; _playerCoins = _primary select 10; _BankCoins = _primary select 11; _hiveVer = _primary select 12; if !(_model in AllPlayers) then {_model = "Survivor2_DZ";}; } else { _isInfected = if (DZE_PlayerZed) then {_primary select 3} else {0}; _model = _primary select 4; _group = _primary select 5; _playerCoins = _primary select 6; _BankCoins = _primary select 7; _hiveVer = _primary select 8; if (isNil "_model") then { _model = "Survivor2_DZ"; } else { if (_model == "") then {_model = "Survivor2_DZ";}; }; //Record initial inventory only if not player zombie if (_isInfected != 1) then { _config = configFile >> "CfgSurvival" >> "Inventory" >> "Default"; _mags = getArray (_config >> "magazines"); _wpns = getArray (_config >> "weapons"); _bcpk = getText (_config >> "backpack"); // * CUSTOM LOADOUT SWITCHCASE! * switch (true) do { case(_humanity >= 5000): { DefaultMagazines = ["itemMap" //etc...]; }; }; if (!isNil "DefaultMagazines") then {_mags = DefaultMagazines;}; if (!isNil "DefaultWeapons") then {_wpns = DefaultWeapons;}; if (!isNil "DefaultBackpack") then {_bcpk = DefaultBackpack;}; //Wait for HIVE to be free _key = format["CHILD:203:%1:%2:%3:",_charID,[_wpns,_mags],[_bcpk,[],[]]]; _key call server_hiveWrite; }; };
Link to comment
Share on other sites
27 answers to this question
Recommended Posts
Please sign in to comment
You will be able to leave a comment after signing in
Sign In Now